mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
feat: trigger ModeChanged for terminal modes
This commit is contained in:
parent
11683193f5
commit
fdfd1eda43
@ -412,6 +412,7 @@ void terminal_enter(void)
|
||||
curwin->w_redr_status = true; // For mode() in statusline. #8323
|
||||
ui_busy_start();
|
||||
apply_autocmds(EVENT_TERMENTER, NULL, NULL, false, curbuf);
|
||||
trigger_modechanged();
|
||||
|
||||
s->state.execute = terminal_execute;
|
||||
s->state.check = terminal_check;
|
||||
|
31
test/functional/autocmd/modechanged_spec.lua
Normal file
31
test/functional/autocmd/modechanged_spec.lua
Normal file
@ -0,0 +1,31 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq
|
||||
local feed, command = helpers.feed, helpers.command
|
||||
|
||||
describe('ModeChanged', function()
|
||||
before_each(function()
|
||||
clear()
|
||||
command('let g:count = 0')
|
||||
command('au ModeChanged * let g:event = copy(v:event)')
|
||||
command('au ModeChanged * let g:count += 1')
|
||||
end)
|
||||
|
||||
it('picks up terminal mode changes', function()
|
||||
command("term")
|
||||
feed('i')
|
||||
eq({
|
||||
old_mode = 'nt',
|
||||
new_mode = 't'
|
||||
}, eval('g:event'))
|
||||
feed('<c-\\><c-n>')
|
||||
eq({
|
||||
old_mode = 't',
|
||||
new_mode = 'nt'
|
||||
}, eval('g:event'))
|
||||
eq(3, eval('g:count'))
|
||||
command("bd!")
|
||||
|
||||
-- v:event is cleared after the autocommand is done
|
||||
eq({}, eval('v:event'))
|
||||
end)
|
||||
end)
|
Loading…
Reference in New Issue
Block a user