diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-01-17 08:18:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-17 08:18:52 +0800 |
commit | 2fce95ec439a1121271798cf00fc8ec9878813fa (patch) | |
tree | 4a8c6fdb1a892be48cd3bc38cc062bd9c1f1788c /test/old/testdir | |
parent | da541c0af1ef6589548140ebce133ad3fecf6d42 (diff) | |
download | rneovim-2fce95ec439a1121271798cf00fc8ec9878813fa.tar.gz rneovim-2fce95ec439a1121271798cf00fc8ec9878813fa.tar.bz2 rneovim-2fce95ec439a1121271798cf00fc8ec9878813fa.zip |
vim-patch:9.1.0033: Insert mode not stopped if closing prompt buffer modifies hidden buffer (#27051)
Problem: Insert mode not stopped if an autocommand modifies a hidden
buffer while closing a prompt buffer.
Solution: Don't set b_prompt_insert if stop_insert_mode is already set.
(zeertzjq)
closes: vim/vim#13872
https://github.com/vim/vim/commit/96958366ad6159efe708b694055320ed19357e61
Diffstat (limited to 'test/old/testdir')
-rw-r--r-- | test/old/testdir/test_prompt_buffer.vim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/old/testdir/test_prompt_buffer.vim b/test/old/testdir/test_prompt_buffer.vim index 3dfbbcece6..20daa07a3d 100644 --- a/test/old/testdir/test_prompt_buffer.vim +++ b/test/old/testdir/test_prompt_buffer.vim @@ -298,4 +298,36 @@ func Test_prompt_appending_while_hidden() call StopVimInTerminal(buf) endfunc +" Modifying a hidden buffer while closing a prompt buffer should not prevent +" stopping of Insert mode. +func Test_prompt_close_modify_hidden() + call CanTestPromptBuffer() + + let script =<< trim END + file hidden + set bufhidden=hide + enew + new prompt + set buftype=prompt + + inoremap <buffer> q <Cmd>bwipe!<CR> + autocmd BufWinLeave prompt call setbufline('hidden', 1, 'Test') + END + call writefile(script, 'XpromptCloseModifyHidden', 'D') + + let buf = RunVimInTerminal('-S XpromptCloseModifyHidden', {'rows': 10}) + call TermWait(buf) + + call term_sendkeys(buf, "a") + call WaitForAssert({-> assert_match('-- INSERT --', term_getline(buf, 10))}) + + call term_sendkeys(buf, "q") + call WaitForAssert({-> assert_notmatch('-- INSERT --', term_getline(buf, 10))}) + + call term_sendkeys(buf, ":bwipe!\<CR>") + call WaitForAssert({-> assert_equal('Test', term_getline(buf, 1))}) + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab |