fix(terminal): <Ignore> should be no-op (#37494)

This commit is contained in:
zeertzjq
2026-01-22 09:26:22 +08:00
committed by GitHub
parent c68e9d2a59
commit 196df35cca
3 changed files with 44 additions and 6 deletions

View File

@@ -1152,14 +1152,18 @@ describe('on_lines does not emit out-of-bounds line indexes when', function()
end)
describe('terminal input', function()
local chan --- @type integer
before_each(function()
clear()
exec_lua([[
chan = exec_lua(function()
_G.input_data = ''
vim.api.nvim_open_term(0, { on_input = function(_, _, _, data)
_G.input_data = _G.input_data .. data
end })
]])
return vim.api.nvim_open_term(0, {
on_input = function(_, _, _, data)
_G.input_data = _G.input_data .. data
end,
})
end)
feed('i')
poke_eventloop()
end)
@@ -1173,6 +1177,35 @@ describe('terminal input', function()
feed('aaa<Help>bbb')
eq('aaabbb', exec_lua([[return _G.input_data]]))
end)
it('<Ignore> is no-op', function()
feed('aaa<Ignore>bbb')
eq('aaabbb', exec_lua([[return _G.input_data]]))
eq({ mode = 't', blocking = false }, api.nvim_get_mode())
feed([[<C-\><Ignore><C-N>]])
eq({ mode = 'nt', blocking = false }, api.nvim_get_mode())
feed('v')
eq({ mode = 'v', blocking = false }, api.nvim_get_mode())
feed('<Esc>')
eq({ mode = 'nt', blocking = false }, api.nvim_get_mode())
feed('i')
eq({ mode = 't', blocking = false }, api.nvim_get_mode())
feed([[<C-\><Ignore><C-O>]])
eq({ mode = 'ntT', blocking = false }, api.nvim_get_mode())
feed('v')
eq({ mode = 'v', blocking = false }, api.nvim_get_mode())
feed('<Esc>')
eq({ mode = 't', blocking = false }, api.nvim_get_mode())
fn.chanclose(chan)
feed('<MouseMove>')
eq({ mode = 't', blocking = false }, api.nvim_get_mode())
feed('<Ignore>')
eq({ mode = 't', blocking = false }, api.nvim_get_mode())
eq('terminal', api.nvim_get_option_value('buftype', { buf = 0 }))
feed('<Space>')
eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
eq('', api.nvim_get_option_value('buftype', { buf = 0 }))
end)
end)
describe('terminal input', function()