aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/testdir/test_window_cmd.vim18
-rw-r--r--src/nvim/window.c10
-rw-r--r--test/functional/legacy/window_cmd_spec.lua33
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)