diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-02-15 00:16:13 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-02-15 00:16:13 +0100 |
commit | c3ef8966081c03ce989f72a1e477df3327ccb971 (patch) | |
tree | 4b8d7384ce1c4ab33348e1294d2037b49f58d429 /src/terminal.c | |
parent | 96baf02aa87dc6ec43850c5617fe53061edd97bf (diff) |
patch 8.1.0923: terminal dump diff swap does not update file namesv8.1.0923
Problem: Terminal dump diff swap does not update file names.
Solution: Also swap the file name. Add a test.
Diffstat (limited to 'src/terminal.c')
-rw-r--r-- | src/terminal.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/terminal.c b/src/terminal.c index e2ae2f600f..714cb2bcbd 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -4816,7 +4816,7 @@ term_swap_diff() bot_start = line_count - bot_rows; sb_line = (sb_line_T *)term->tl_scrollback.ga_data; - /* move lines from top to above the bottom part */ + // move lines from top to above the bottom part for (lnum = 1; lnum <= top_rows; ++lnum) { p = vim_strsave(ml_get(1)); @@ -4827,7 +4827,7 @@ term_swap_diff() vim_free(p); } - /* move lines from bottom to the top */ + // move lines from bottom to the top for (lnum = 1; lnum <= bot_rows; ++lnum) { p = vim_strsave(ml_get(bot_start + lnum)); @@ -4838,6 +4838,22 @@ term_swap_diff() vim_free(p); } + // move top title to bottom + p = vim_strsave(ml_get(bot_rows + 1)); + if (p == NULL) + return OK; + ml_append(line_count - top_rows - 1, p, 0, FALSE); + ml_delete(bot_rows + 1, FALSE); + vim_free(p); + + // move bottom title to top + p = vim_strsave(ml_get(line_count - top_rows)); + if (p == NULL) + return OK; + ml_delete(line_count - top_rows, FALSE); + ml_append(bot_rows, p, 0, FALSE); + vim_free(p); + if (top_rows == bot_rows) { /* rows counts are equal, can swap cell properties */ |