From 82b1a389ba98f5f8e8d6c9d7485386be272a22df Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 29 Oct 2023 09:32:03 +0800 Subject: fix(terminal): avoid Insert mode in Terminal buffer (#25820) --- test/functional/terminal/ex_terminal_spec.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/functional/terminal/ex_terminal_spec.lua') diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index 6020a12ddb..f628e261a2 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -125,6 +125,20 @@ describe(':terminal', function() feed('a') eq({ blocking=false, mode='t' }, nvim('get_mode')) end) + + it('switching to terminal buffer in Insert mode goes to Terminal mode #7164', function() + command('terminal') + command('vnew') + feed('i') + command('let g:events = []') + command('autocmd InsertLeave * let g:events += ["InsertLeave"]') + command('autocmd TermEnter * let g:events += ["TermEnter"]') + command('inoremap wincmd p') + eq({ blocking=false, mode='i' }, nvim('get_mode')) + feed('') + eq({ blocking=false, mode='t' }, nvim('get_mode')) + eq({'InsertLeave', 'TermEnter'}, eval('g:events')) + end) end) describe(':terminal (with fake shell)', function() -- cgit