aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal/ex_terminal_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-10-29 09:32:03 +0800
committerGitHub <noreply@github.com>2023-10-29 09:32:03 +0800
commit82b1a389ba98f5f8e8d6c9d7485386be272a22df (patch)
tree37ed7de40ec7267b2fc9d7005b8896af5cd60484 /test/functional/terminal/ex_terminal_spec.lua
parenta5629abce29668e9781768986f7e799ba429f017 (diff)
downloadrneovim-82b1a389ba98f5f8e8d6c9d7485386be272a22df.tar.gz
rneovim-82b1a389ba98f5f8e8d6c9d7485386be272a22df.tar.bz2
rneovim-82b1a389ba98f5f8e8d6c9d7485386be272a22df.zip
fix(terminal): avoid Insert mode in Terminal buffer (#25820)
Diffstat (limited to 'test/functional/terminal/ex_terminal_spec.lua')
-rw-r--r--test/functional/terminal/ex_terminal_spec.lua14
1 files changed, 14 insertions, 0 deletions
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 <F2> <Cmd>wincmd p<CR>')
+ eq({ blocking=false, mode='i' }, nvim('get_mode'))
+ feed('<F2>')
+ eq({ blocking=false, mode='t' }, nvim('get_mode'))
+ eq({'InsertLeave', 'TermEnter'}, eval('g:events'))
+ end)
end)
describe(':terminal (with fake shell)', function()