mirror of
https://github.com/neovim/neovim.git
synced 2025-11-26 12:10:40 +00:00
vim-patch:8.2.3671: restarting Insert mode in prompt buffer too often
Problem: Restarting Insert mode in prompt buffer too often when a callback
switches windows and comes back. (Sean Dewar)
Solution: Do not set "restart_edit" when already in Insert mode.
34c20ff85b
As Test_prompt_switch_windows is skipped, implement it in prompt_buffer_spec.
Replace the 50ms term_wait calls with poke_eventloop (test seems to work anyway
without them, so maybe they're not required?)
The new test does include a duplicate screen test that may generate a "screen
test succeeded immediately" warning, but this is done to match the Vim test.
This commit is contained in:
@@ -31,6 +31,10 @@ describe('prompt buffer', function()
|
||||
func TimerFunc(text)
|
||||
call append(line("$") - 1, 'Result: "' . a:text .'"')
|
||||
endfunc
|
||||
|
||||
func SwitchWindows()
|
||||
call timer_start(0, {-> execute("wincmd p|wincmd p", "")})
|
||||
endfunc
|
||||
]])
|
||||
feed_command("set noshowmode | set laststatus=0")
|
||||
feed_command("call setline(1, 'other buffer')")
|
||||
@@ -167,6 +171,51 @@ describe('prompt buffer', function()
|
||||
]])
|
||||
end)
|
||||
|
||||
it('switch windows', function()
|
||||
feed_command("set showmode")
|
||||
feed("i")
|
||||
screen:expect([[
|
||||
cmd: ^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
[Prompt] [+] |
|
||||
other buffer |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
-- INSERT -- |
|
||||
]])
|
||||
feed("<C-O>:call SwitchWindows()<CR>")
|
||||
poke_eventloop()
|
||||
screen:expect([[
|
||||
cmd: ^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
[Prompt] [+] |
|
||||
other buffer |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
-- INSERT -- |
|
||||
]])
|
||||
feed("<Esc>")
|
||||
poke_eventloop()
|
||||
screen:expect([[
|
||||
cmd:^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
[Prompt] [+] |
|
||||
other buffer |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
it('keeps insert mode after aucmd_restbuf in callback', function()
|
||||
source [[
|
||||
let s:buf = nvim_create_buf(1, 1)
|
||||
|
||||
Reference in New Issue
Block a user