aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/prompt_buffer_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-01-17 08:18:52 +0800
committerGitHub <noreply@github.com>2024-01-17 08:18:52 +0800
commit2fce95ec439a1121271798cf00fc8ec9878813fa (patch)
tree4a8c6fdb1a892be48cd3bc38cc062bd9c1f1788c /test/functional/legacy/prompt_buffer_spec.lua
parentda541c0af1ef6589548140ebce133ad3fecf6d42 (diff)
downloadrneovim-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/functional/legacy/prompt_buffer_spec.lua')
-rw-r--r--test/functional/legacy/prompt_buffer_spec.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/functional/legacy/prompt_buffer_spec.lua b/test/functional/legacy/prompt_buffer_spec.lua
index 0c6898526e..59a9283868 100644
--- a/test/functional/legacy/prompt_buffer_spec.lua
+++ b/test/functional/legacy/prompt_buffer_spec.lua
@@ -4,6 +4,7 @@ local feed = helpers.feed
local source = helpers.source
local clear = helpers.clear
local command = helpers.command
+local expect = helpers.expect
local poke_eventloop = helpers.poke_eventloop
local api = helpers.api
local eq = helpers.eq
@@ -217,4 +218,24 @@ describe('prompt buffer', function()
command('call DoAppend()')
eq({ mode = 'i', blocking = false }, api.nvim_get_mode())
end)
+
+ -- oldtest: Test_prompt_close_modify_hidden()
+ it('modifying hidden buffer does not prevent prompt buffer mode change', function()
+ source([[
+ 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')
+ ]])
+ feed('a')
+ eq({ mode = 'i', blocking = false }, api.nvim_get_mode())
+ feed('q')
+ eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
+ command('bwipe!')
+ expect('Test')
+ end)
end)