diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-29 08:53:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-29 08:53:16 +0800 |
commit | 31eb20d915749dfcf2c3071a2b1e1393070b3efb (patch) | |
tree | 5936e26ddd1c198c034c9a2ad282d7eaf168f26b | |
parent | 80b6edabe3e4203ee4bf50261af07a6a0495ef36 (diff) | |
parent | 6b18c77a276f95691708fbff72ed75bac9214a2c (diff) | |
download | rneovim-31eb20d915749dfcf2c3071a2b1e1393070b3efb.tar.gz rneovim-31eb20d915749dfcf2c3071a2b1e1393070b3efb.tar.bz2 rneovim-31eb20d915749dfcf2c3071a2b1e1393070b3efb.zip |
Merge pull request #21224 from luukvbaal/vim-9.0.0964
refactor(ui): statusbar invalidation to win_set_inner_size()
-rw-r--r-- | src/nvim/testdir/test_window_cmd.vim | 18 | ||||
-rw-r--r-- | src/nvim/window.c | 10 | ||||
-rw-r--r-- | test/functional/legacy/window_cmd_spec.lua | 33 |
3 files changed, 52 insertions, 9 deletions
diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim index 20564fed66..6e8368f71d 100644 --- a/src/nvim/testdir/test_window_cmd.vim +++ b/src/nvim/testdir/test_window_cmd.vim @@ -1793,4 +1793,22 @@ function Test_splitkeep_fold() call VerifyScreenDump(buf, 'Test_splitkeep_fold_4', {}) endfunction +function Test_splitkeep_status() + CheckScreendump + + let lines =<< trim END + call setline(1, ['a', 'b', 'c']) + set nomodified + set splitkeep=screen + let win = winnr() + wincmd s + wincmd j + END + call writefile(lines, 'XTestSplitkeepStatus', 'D') + let buf = RunVimInTerminal('-S XTestSplitkeepStatus', #{rows: 10}) + + call term_sendkeys(buf, ":call win_move_statusline(win, 1)\<CR>") + call VerifyScreenDump(buf, 'Test_splitkeep_status_1', {}) +endfunction + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/window.c b/src/nvim/window.c index 3d10f89a2c..d29a364b4f 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -6389,9 +6389,6 @@ void win_new_height(win_T *wp, int height) wp->w_height = height; wp->w_pos_changed = true; win_set_inner_size(wp, true); - if (wp->w_status_height) { - wp->w_redr_status = true; - } } void scroll_to_fraction(win_T *wp, int prev_height) @@ -6487,7 +6484,6 @@ void scroll_to_fraction(win_T *wp, int prev_height) } redraw_later(wp, UPD_SOME_VALID); - wp->w_redr_status = true; invalidate_botline_win(wp); } @@ -6554,6 +6550,7 @@ void win_set_inner_size(win_T *wp, bool valid_cursor) wp->w_width_outer = (wp->w_width_inner + win_border_width(wp)); wp->w_winrow_off = wp->w_border_adj[0] + wp->w_winbar_height; wp->w_wincol_off = wp->w_border_adj[3]; + wp->w_redr_status = true; } static int win_border_height(win_T *wp) @@ -6570,10 +6567,8 @@ static int win_border_width(win_T *wp) void win_new_width(win_T *wp, int width) { wp->w_width = width; - win_set_inner_size(wp, true); - - wp->w_redr_status = true; wp->w_pos_changed = true; + win_set_inner_size(wp, true); } void win_comp_scroll(win_T *wp) @@ -6974,7 +6969,6 @@ int set_winbar_win(win_T *wp, bool make_room, bool valid_cursor) } wp->w_winbar_height = winbar_height; win_set_inner_size(wp, valid_cursor); - wp->w_redr_status = wp->w_redr_status || winbar_height; if (winbar_height == 0) { // When removing winbar, deallocate the w_winbar_click_defs array diff --git a/test/functional/legacy/window_cmd_spec.lua b/test/functional/legacy/window_cmd_spec.lua index 8b89c55f5b..0e9775060d 100644 --- a/test/functional/legacy/window_cmd_spec.lua +++ b/test/functional/legacy/window_cmd_spec.lua @@ -6,9 +6,11 @@ local exec_lua = helpers.exec_lua local feed = helpers.feed describe('splitkeep', function() - local screen = Screen.new() + local screen + before_each(function() clear('--cmd', 'set splitkeep=screen') + screen = Screen.new() screen:attach() end) @@ -193,4 +195,33 @@ describe('splitkeep', function() :quit | ]]) end) + + -- oldtest: Test_splitkeep_status() + it('does not scroll when split in callback', function() + exec([[ + call setline(1, ['a', 'b', 'c']) + set nomodified + set splitkeep=screen + let win = winnr() + wincmd s + wincmd j + ]]) + feed(':call win_move_statusline(win, 1)<CR>') + screen:expect([[ + a | + b | + c | + ~ | + ~ | + ~ | + ~ | + [No Name] | + ^a | + b | + c | + ~ | + [No Name] | + | + ]]) + end) end) |