diff options
author | Christian Clason <c.clason@uni-graz.at> | 2024-01-03 19:09:43 +0100 |
---|---|---|
committer | Christian Clason <c.clason@uni-graz.at> | 2024-01-03 23:09:55 +0100 |
commit | bdfea2a8919963dfe24052635883f0213cff83e8 (patch) | |
tree | 43bf5a002b112fabc7a4da82bc54648d8e62a336 /test | |
parent | 5dbf6ab9b1027b4b5d3703a0ccc1d298cbe6c018 (diff) | |
download | rneovim-bdfea2a8919963dfe24052635883f0213cff83e8.tar.gz rneovim-bdfea2a8919963dfe24052635883f0213cff83e8.tar.bz2 rneovim-bdfea2a8919963dfe24052635883f0213cff83e8.zip |
vim-patch:9.1.0001: when closing window, wincmd p may fail
Avoid `prevwin == curwin` when closing `curwin`
Problem: When closing the current window (or when moving it to a tabpage), the
previous window may refer to the new current window
(`winnr() == winnr('#')`) if that window is selected as the
new current window.
Solution: Set `prevwin = NULL` when switching away from an invalid `curwin` and
the target window was the `prevwin`.
(Sean Dewar)
related: vim/vim#4537
closes: vim/vim#13762
https://github.com/vim/vim/commit/bf44b69d1f91d9778ae1887128c63d35d9a3d19b
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_window_cmd.vim | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/old/testdir/test_window_cmd.vim b/test/old/testdir/test_window_cmd.vim index 152d1bacc7..da1711a0a1 100644 --- a/test/old/testdir/test_window_cmd.vim +++ b/test/old/testdir/test_window_cmd.vim @@ -113,6 +113,64 @@ func Test_window_quit() bw Xa Xb endfunc +func Test_window_curwin_not_prevwin() + botright split + call assert_equal(2, winnr()) + call assert_equal(1, winnr('#')) + quit + call assert_equal(1, winnr()) + call assert_equal(0, winnr('#')) + + botright split + botright split + call assert_equal(3, winnr()) + call assert_equal(2, winnr('#')) + 1quit + call assert_equal(2, winnr()) + call assert_equal(1, winnr('#')) + + botright split + call assert_equal(1, tabpagenr()) + call assert_equal(3, winnr()) + call assert_equal(2, winnr('#')) + wincmd T + call assert_equal(2, tabpagenr()) + call assert_equal(1, winnr()) + call assert_equal(0, winnr('#')) + tabfirst + call assert_equal(1, tabpagenr()) + call assert_equal(2, winnr()) + call assert_equal(0, winnr('#')) + + tabonly + botright split + wincmd t + wincmd p + call assert_equal(3, winnr()) + call assert_equal(1, winnr('#')) + quit + call assert_equal(2, winnr()) + call assert_equal(1, winnr('#')) + + botright split + wincmd t + wincmd p + call assert_equal(1, tabpagenr()) + call assert_equal(3, winnr()) + call assert_equal(1, winnr('#')) + wincmd T + call assert_equal(2, tabpagenr()) + call assert_equal(1, winnr()) + call assert_equal(0, winnr('#')) + tabfirst + call assert_equal(1, tabpagenr()) + call assert_equal(2, winnr()) + call assert_equal(1, winnr('#')) + + tabonly + only +endfunc + func Test_window_horizontal_split() call assert_equal(1, winnr('$')) 3wincmd s |