diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-01-16 17:19:59 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-01-16 17:21:04 +0100 |
commit | 96958366ad6159efe708b694055320ed19357e61 (patch) | |
tree | 3a18368475fd3def1c844ad8de8056be233afe57 /src/testdir | |
parent | 1a9aba8ad49ef77e69f429093d44888e7eafde7c (diff) |
patch 9.1.0033: Insert mode not stopped if closing prompt buffer modifies hidden bufferv9.1.0033
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: #13872
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_prompt_buffer.vim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/testdir/test_prompt_buffer.vim b/src/testdir/test_prompt_buffer.vim index d173731607..81a293db0e 100644 --- a/src/testdir/test_prompt_buffer.vim +++ b/src/testdir/test_prompt_buffer.vim @@ -297,4 +297,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 |