aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-01-29 21:32:44 +0800
committerGitHub <noreply@github.com>2022-01-29 21:32:44 +0800
commited0808412cc5e8b53e4d1d1ad466c4f710a03e66 (patch)
treea2b1444eecc8c429408b7f5d6571aba7e3fcb884 /src
parent6dcdec8042e69c151f40974486b0e3d254596e6c (diff)
parent950a88d4c2a9c17b5a679b4e41fab9f64b8cf9df (diff)
downloadrneovim-ed0808412cc5e8b53e4d1d1ad466c4f710a03e66.tar.gz
rneovim-ed0808412cc5e8b53e4d1d1ad466c4f710a03e66.tar.bz2
rneovim-ed0808412cc5e8b53e4d1d1ad466c4f710a03e66.zip
Merge pull request #17234 from zeertzjq/vim-8.2.4248
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/test_window_cmd.vim20
-rw-r--r--src/nvim/window.c5
2 files changed, 23 insertions, 2 deletions
diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim
index 9b07d83f43..db5c0b2a11 100644
--- a/src/nvim/testdir/test_window_cmd.vim
+++ b/src/nvim/testdir/test_window_cmd.vim
@@ -968,6 +968,12 @@ func Test_win_move_separator()
call assert_true(id->win_move_separator(-offset))
call assert_equal(w, winwidth(id))
endfor
+ " check win_move_separator from right window on right window is no-op
+ let w0 = winwidth(0)
+ call assert_true(win_move_separator(0, 1))
+ call assert_equal(w0, winwidth(0))
+ call assert_true(win_move_separator(0, -1))
+ call assert_equal(w0, winwidth(0))
" check that win_move_separator doesn't error with offsets beyond moving
" possibility
call assert_true(win_move_separator(id, 5000))
@@ -990,6 +996,7 @@ func Test_win_move_separator()
endfunc
func Test_win_move_statusline()
+ redraw " This test fails in Nvim without a redraw to clear messages.
edit a
leftabove split b
let h = winheight(0)
@@ -1010,6 +1017,19 @@ func Test_win_move_statusline()
call assert_true(win_move_statusline(1, -offset))
call assert_equal(h, winheight(1))
endfor
+ " check win_move_statusline from bottom window on bottom window
+ let h0 = winheight(0)
+ for offset in range(5)
+ call assert_true(0->win_move_statusline(-offset))
+ call assert_equal(h0 - offset, winheight(0))
+ call assert_equal(1 + offset, &cmdheight)
+ call assert_true(win_move_statusline(0, offset))
+ call assert_equal(h0, winheight(0))
+ call assert_equal(1, &cmdheight)
+ endfor
+ call assert_true(win_move_statusline(0, 1))
+ call assert_equal(h0, winheight(0))
+ call assert_equal(1, &cmdheight)
" check win_move_statusline from bottom window on top window ID
let id = win_getid(1)
for offset in range(5)
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 1e747a67e9..8e44fd5014 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -5795,7 +5795,6 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
}
fr = curfr; // put fr at window that grows
}
- assert(fr);
// Not enough room
if (room < offset) {
@@ -5808,7 +5807,9 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
}
if (fr == NULL) {
- return; // Safety check, should not happen.
+ // This can happen when calling win_move_separator() on the rightmost
+ // window. Just don't do anything.
+ return;
}
// grow frame fr by offset lines