patch 9.0.0824: crash when using win_move_separator() in other tab page
Problem: Crash when using win_move_separator() in other tab page.
Solution: Check for valid window in current tab page.
(closes #11479, closes #11427)
diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim
index 8a71913..0d4c278 100644
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -1483,23 +1483,33 @@
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))
call assert_true(winwidth(id) > w)
call assert_true(win_move_separator(id, -5000))
call assert_true(winwidth(id) < w)
+
" check that win_move_separator returns false for an invalid window
wincmd =
let w = winwidth(0)
call assert_false(win_move_separator(-1, 1))
call assert_equal(w, winwidth(0))
+
" check that win_move_separator returns false for a popup window
let id = popup_create(['hello', 'world'], {})
let w = winwidth(id)
call assert_false(win_move_separator(id, 1))
call assert_equal(w, winwidth(id))
call popup_close(id)
+
+ " check that using another tabpage fails without crash
+ let id = win_getid()
+ tabnew
+ call assert_fails('call win_move_separator(id, -1)', 'E1308:')
+ tabclose
+
%bwipe!
endfunc