aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_window_cmd.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-01 20:22:48 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-11-02 08:06:37 +0800
commit39f85cdf6b40cbdd26256260d0d6d4e071b631a2 (patch)
tree4edecc7da99f4878bff893740b932a1b0c1d01a2 /src/nvim/testdir/test_window_cmd.vim
parent20bd4d89977005845c070cde9df75496f948fa1e (diff)
downloadrneovim-39f85cdf6b40cbdd26256260d0d6d4e071b631a2.tar.gz
rneovim-39f85cdf6b40cbdd26256260d0d6d4e071b631a2.tar.bz2
rneovim-39f85cdf6b40cbdd26256260d0d6d4e071b631a2.zip
vim-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 vim/vim#11479, closes vim/vim#11427) https://github.com/vim/vim/commit/873f41a0187e81a22aa4622fbf938de72a54abba
Diffstat (limited to 'src/nvim/testdir/test_window_cmd.vim')
-rw-r--r--src/nvim/testdir/test_window_cmd.vim10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim
index 902a3791d4..f38eaaf318 100644
--- a/src/nvim/testdir/test_window_cmd.vim
+++ b/src/nvim/testdir/test_window_cmd.vim
@@ -1393,17 +1393,20 @@ func Test_win_move_separator()
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 floating window
let id = nvim_open_win(
\ 0, 0, #{relative: 'editor', row: 2, col: 2, width: 5, height: 3})
@@ -1411,6 +1414,13 @@ func Test_win_move_separator()
call assert_false(win_move_separator(id, 1))
call assert_equal(w, winwidth(id))
call nvim_win_close(id, 1)
+
+ " 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