diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-14 20:31:19 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-14 20:34:05 +0800 |
commit | 08235b6f2a668285347c7e2c1f1cdf81920cfecb (patch) | |
tree | 6e4998b8f7bced8ffc853bcf3969ebb2962913df /src | |
parent | b41f2bcae77ca2efa52af4f3dd1ba33074d576cf (diff) | |
download | rneovim-08235b6f2a668285347c7e2c1f1cdf81920cfecb.tar.gz rneovim-08235b6f2a668285347c7e2c1f1cdf81920cfecb.tar.bz2 rneovim-08235b6f2a668285347c7e2c1f1cdf81920cfecb.zip |
vim-patch:8.2.0921: CTRL-W T in cmdline window causes trouble
Problem: CTRL-W T in cmdline window causes trouble.
Solution: Disallow CTRL-W T in the cmdline window. Add more tests.
(Naruhiko Nishino, closes vim/vim#6219)
https://github.com/vim/vim/commit/4fdb8bd0546ac8d90560a4fad359a48667089d43
Test already passes in Nvim because of later patches.
Move Test_cmdwin_jump_to_win() to the right place.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/testdir/test_cmdline.vim | 53 | ||||
-rw-r--r-- | src/nvim/window.c | 1 |
2 files changed, 38 insertions, 16 deletions
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 5d5713d0e3..a8d03df5bd 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -1326,22 +1326,6 @@ func Test_cmdwin_autocmd() augroup! CmdWin endfunc -func Test_cmdwin_jump_to_win() - call assert_fails('call feedkeys("q:\<C-W>\<C-W>\<CR>", "xt")', 'E11:') - new - set modified - call assert_fails('call feedkeys("q/:qall\<CR>", "xt")', 'E162:') - close! - call feedkeys("q/:close\<CR>", "xt") - call assert_equal(1, winnr('$')) - call feedkeys("q/:exit\<CR>", "xt") - call assert_equal(1, winnr('$')) - - " opening command window twice should fail - call assert_beeps('call feedkeys("q:q:\<CR>\<CR>", "xt")') - call assert_equal(1, winnr('$')) -endfunc - func Test_cmdlineclear_tabenter() " See test/functional/legacy/cmdline_spec.lua CheckScreendump @@ -1379,6 +1363,22 @@ func Test_cmdline_expand_special() call delete('Xfile.java') endfunc +func Test_cmdwin_jump_to_win() + call assert_fails('call feedkeys("q:\<C-W>\<C-W>\<CR>", "xt")', 'E11:') + new + set modified + call assert_fails('call feedkeys("q/:qall\<CR>", "xt")', 'E162:') + close! + call feedkeys("q/:close\<CR>", "xt") + call assert_equal(1, winnr('$')) + call feedkeys("q/:exit\<CR>", "xt") + call assert_equal(1, winnr('$')) + + " opening command window twice should fail + call assert_beeps('call feedkeys("q:q:\<CR>\<CR>", "xt")') + call assert_equal(1, winnr('$')) +endfunc + " Test for backtick expression in the command line func Test_cmd_backtick() %argd @@ -1698,6 +1698,27 @@ func Test_cmdwin_blocked_commands() call assert_fails('call feedkeys("q:Q\<CR>", "xt")', 'E11:') call assert_fails('call feedkeys("q:Z\<CR>", "xt")', 'E11:') call assert_fails('call feedkeys("q:\<F1>\<CR>", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>s", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>v", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>^", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>n", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>z", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>o", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>w", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>j", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>k", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>h", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>l", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>T", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>x", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>r", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>R", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>K", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>}", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>]", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>f", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>d", "xt")', 'E11:') + call assert_fails('call feedkeys("q:\<C-W>g", "xt")', 'E11:') endfunc " test that ";" works to find a match at the start of the first line diff --git a/src/nvim/window.c b/src/nvim/window.c index 7895391697..cf10e635b6 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -331,6 +331,7 @@ newwindow: // move window to new tab page case 'T': + CHECK_CMDWIN; if (one_window(curwin)) { msg(_(m_onlyone)); } else { |