diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-01-17 21:22:59 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-01-17 21:22:59 +0100 |
commit | f267847017976ab85117bdf75b45e769836f8d69 (patch) | |
tree | d57462af4d3a29cb32ebd31e714a7a6de56c40eb /src/testdir | |
parent | 6a8d2e1634f8f0d7463a2786dbcbe0f38dd287a7 (diff) |
patch 9.1.0040: issue with prompt buffer and hidden bufferv9.1.0040
Problem: Modifying a hidden buffer still interferes with prompt buffer
mode changes.
Solution: Save and restore b_prompt_insert.
(zeertzjq)
closes: #13875
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Modifying hidden buffer still interferes with prompt buffer mode changes
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_prompt_buffer.vim | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/testdir/test_prompt_buffer.vim b/src/testdir/test_prompt_buffer.vim index 81a293db0e..c5ef010343 100644 --- a/src/testdir/test_prompt_buffer.vim +++ b/src/testdir/test_prompt_buffer.vim @@ -297,9 +297,10 @@ 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() +" Modifying a hidden buffer while leaving a prompt buffer should not prevent +" stopping of Insert mode, and returning to the prompt buffer later should +" restore Insert mode. +func Test_prompt_leave_modify_hidden() call CanTestPromptBuffer() let script =<< trim END @@ -309,22 +310,34 @@ func Test_prompt_close_modify_hidden() new prompt set buftype=prompt + inoremap <buffer> w <Cmd>wincmd w<CR> inoremap <buffer> q <Cmd>bwipe!<CR> - autocmd BufWinLeave prompt call setbufline('hidden', 1, 'Test') + autocmd BufLeave prompt call appendbufline('hidden', '$', 'Leave') + autocmd BufEnter prompt call appendbufline('hidden', '$', 'Enter') + autocmd BufWinLeave prompt call appendbufline('hidden', '$', 'Close') END - call writefile(script, 'XpromptCloseModifyHidden', 'D') + call writefile(script, 'XpromptLeaveModifyHidden', 'D') - let buf = RunVimInTerminal('-S XpromptCloseModifyHidden', {'rows': 10}) + let buf = RunVimInTerminal('-S XpromptLeaveModifyHidden', {'rows': 10}) call TermWait(buf) call term_sendkeys(buf, "a") call WaitForAssert({-> assert_match('-- INSERT --', term_getline(buf, 10))}) + call term_sendkeys(buf, "w") + call WaitForAssert({-> assert_notmatch('-- INSERT --', term_getline(buf, 10))}) + + call term_sendkeys(buf, "\<C-W>w") + 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 WaitForAssert({-> assert_equal('Leave', term_getline(buf, 2))}) + call WaitForAssert({-> assert_equal('Enter', term_getline(buf, 3))}) + call WaitForAssert({-> assert_equal('Leave', term_getline(buf, 4))}) + call WaitForAssert({-> assert_equal('Close', term_getline(buf, 5))}) call StopVimInTerminal(buf) endfunc |