vim-patch:8.2.3461: distinguish Normal and Terminal-Normal mode #15878

Problem:    Cannot distinguish Normal and Terminal-Normal mode.
Solution:   Make mode() return "nt" for Terminal-Normal mode. (issue vim/vim#8856)
72406a4bd2
This commit is contained in:
zeertzjq
2021-10-10 09:15:46 +08:00
committed by GitHub
parent 65b8232260
commit f4359b5dbd
7 changed files with 32 additions and 11 deletions

View File

@@ -96,19 +96,28 @@ describe(':terminal', function()
eq(3, #jumps)
end)
it('nvim_get_mode() in :terminal', function()
command(':terminal')
eq({ blocking=false, mode='nt' }, nvim('get_mode'))
feed('i')
eq({ blocking=false, mode='t' }, nvim('get_mode'))
feed([[<C-\><C-N>]])
eq({ blocking=false, mode='nt' }, nvim('get_mode'))
end)
it(':stopinsert RPC request exits terminal-mode #7807', function()
command(':terminal')
feed('i[tui] insert-mode')
eq({ blocking=false, mode='t' }, nvim('get_mode'))
command('stopinsert')
eq({ blocking=false, mode='n' }, nvim('get_mode'))
eq({ blocking=false, mode='nt' }, nvim('get_mode'))
end)
it(':stopinsert in normal mode doesn\'t break insert mode #9889', function()
command(':terminal')
eq({ blocking=false, mode='n' }, nvim('get_mode'))
eq({ blocking=false, mode='nt' }, nvim('get_mode'))
command(':stopinsert')
eq({ blocking=false, mode='n' }, nvim('get_mode'))
eq({ blocking=false, mode='nt' }, nvim('get_mode'))
feed('a')
eq({ blocking=false, mode='t' }, nvim('get_mode'))
end)