mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(terminal): avoid Insert mode in Terminal buffer (#25820)
This commit is contained in:
parent
a5629abce2
commit
82b1a389ba
@ -396,6 +396,13 @@ static int insert_check(VimState *state)
|
|||||||
Insstart_orig = Insstart;
|
Insstart_orig = Insstart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (curbuf->terminal) {
|
||||||
|
// Exit Insert mode and go to Terminal mode.
|
||||||
|
stop_insert_mode = true;
|
||||||
|
restart_edit = 'I';
|
||||||
|
stuffcharReadbuff(K_NOP);
|
||||||
|
}
|
||||||
|
|
||||||
if (stop_insert_mode && !ins_compl_active()) {
|
if (stop_insert_mode && !ins_compl_active()) {
|
||||||
// ":stopinsert" used
|
// ":stopinsert" used
|
||||||
s->count = 0;
|
s->count = 0;
|
||||||
|
@ -125,6 +125,20 @@ describe(':terminal', function()
|
|||||||
feed('a')
|
feed('a')
|
||||||
eq({ blocking=false, mode='t' }, nvim('get_mode'))
|
eq({ blocking=false, mode='t' }, nvim('get_mode'))
|
||||||
end)
|
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)
|
end)
|
||||||
|
|
||||||
describe(':terminal (with fake shell)', function()
|
describe(':terminal (with fake shell)', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user