mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 15:21:47 +00:00
vim-patch:8.2.4248: no proper test for moving the window separator
Problem: No proper test for moving the window separator.
Solution: Add a test. Add comment in code. (closes vim/vim#9656)
a0c4e2f2d7
Remove the assertion as it is now possible for `fr` to be `NULL`.
The test fails without clearing messages. Not sure if this is a bug.
This commit is contained in:
@@ -968,6 +968,12 @@ func Test_win_move_separator()
|
|||||||
call assert_true(id->win_move_separator(-offset))
|
call assert_true(id->win_move_separator(-offset))
|
||||||
call assert_equal(w, winwidth(id))
|
call assert_equal(w, winwidth(id))
|
||||||
endfor
|
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
|
" check that win_move_separator doesn't error with offsets beyond moving
|
||||||
" possibility
|
" possibility
|
||||||
call assert_true(win_move_separator(id, 5000))
|
call assert_true(win_move_separator(id, 5000))
|
||||||
@@ -990,6 +996,7 @@ func Test_win_move_separator()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_win_move_statusline()
|
func Test_win_move_statusline()
|
||||||
|
redraw " This test fails in Nvim without a redraw to clear messages.
|
||||||
edit a
|
edit a
|
||||||
leftabove split b
|
leftabove split b
|
||||||
let h = winheight(0)
|
let h = winheight(0)
|
||||||
@@ -1010,6 +1017,19 @@ func Test_win_move_statusline()
|
|||||||
call assert_true(win_move_statusline(1, -offset))
|
call assert_true(win_move_statusline(1, -offset))
|
||||||
call assert_equal(h, winheight(1))
|
call assert_equal(h, winheight(1))
|
||||||
endfor
|
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
|
" check win_move_statusline from bottom window on top window ID
|
||||||
let id = win_getid(1)
|
let id = win_getid(1)
|
||||||
for offset in range(5)
|
for offset in range(5)
|
||||||
|
@@ -5795,7 +5795,6 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
|
|||||||
}
|
}
|
||||||
fr = curfr; // put fr at window that grows
|
fr = curfr; // put fr at window that grows
|
||||||
}
|
}
|
||||||
assert(fr);
|
|
||||||
|
|
||||||
// Not enough room
|
// Not enough room
|
||||||
if (room < offset) {
|
if (room < offset) {
|
||||||
@@ -5808,7 +5807,9 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fr == NULL) {
|
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
|
// grow frame fr by offset lines
|
||||||
|
Reference in New Issue
Block a user