diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2023-08-15 19:38:52 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2024-01-28 12:29:42 +0000 |
commit | d85f180f26c0570c2510c899a0bf0023ec55a692 (patch) | |
tree | dd8e365576a87aaa20bef6848f4b31a52163d582 /test | |
parent | 7bb0dd08dbcd8cfeeaea725e2c00e9e5cfcae2bd (diff) | |
download | rneovim-d85f180f26c0570c2510c899a0bf0023ec55a692.tar.gz rneovim-d85f180f26c0570c2510c899a0bf0023ec55a692.tar.bz2 rneovim-d85f180f26c0570c2510c899a0bf0023ec55a692.zip |
vim-patch:9.1.0049: Make "[Command Line]" a special buffer name
Problem: E95 is possible if a buffer called "[Command Line]" already
exists when opening the cmdwin. This can also happen if the
cmdwin's buffer could not be deleted when closing.
Solution: Un-name the cmdwin buffer, and give it a special name instead,
similar to what's done for quickfix buffers and for unnamed
prompt and scratch buffers. As a result, BufFilePre/Post are
no longer fired when opening the cmdwin. Add a "command" key
to the dictionary returned by getbufinfo() to differentiate
the cmdwin buffer instead. (Sean Dewar)
Cherry-pick test_normal changes from v9.0.0954.
https://github.com/vim/vim/commit/1fb41032060df09ca2640dc49541f11062f6dfaa
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_cmdwin.vim | 13 | ||||
-rw-r--r-- | test/old/testdir/test_normal.vim | 13 |
2 files changed, 22 insertions, 4 deletions
diff --git a/test/old/testdir/test_cmdwin.vim b/test/old/testdir/test_cmdwin.vim index 14305155d8..9b1a45708e 100644 --- a/test/old/testdir/test_cmdwin.vim +++ b/test/old/testdir/test_cmdwin.vim @@ -192,4 +192,17 @@ func Test_cmdwin_interrupted() delfunc CheckInterrupted endfunc +func Test_cmdwin_existing_bufname() + func CheckName() + call assert_equal(1, getbufinfo('')[0].command) + call assert_equal(0, getbufinfo('[Command Line]')[0].command) + call assert_match('#a\s*"\[Command Line\]"', execute('ls')) + call assert_match('%a\s*"\[Command Line\]"', execute('ls')) + endfunc + file [Command Line] + call feedkeys("q::call CheckName()\<CR>:q\<CR>", 'ntx') + 0file + delfunc CheckName +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index c72d83fa52..b98547061e 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -3167,15 +3167,18 @@ endfunc func Test_normal50_commandline() CheckFeature timers CheckFeature cmdline_hist + func! DoTimerWork(id) - call assert_equal('[Command Line]', bufname('')) + call assert_equal(1, getbufinfo('')[0].command) + " should fail, with E11, but does fail with E23? "call feedkeys("\<c-^>", 'tm') - " should also fail with E11 + " should fail with E11 - "Invalid in command-line window" call assert_fails(":wincmd p", 'E11') - " return from commandline window - call feedkeys("\<cr>") + + " Return from commandline window. + call feedkeys("\<CR>", 't') endfunc let oldlang=v:lang @@ -3188,7 +3191,9 @@ func Test_normal50_commandline() catch /E23/ " no-op endtry + " clean up + delfunc DoTimerWork set updatetime=4000 exe "lang" oldlang bw! |