mirror of
https://github.com/neovim/neovim.git
synced 2026-07-11 20:09:44 +00:00
fix(terminal): <Ignore> should be no-op (#37494)
This commit is contained in:
@@ -169,7 +169,7 @@ void os_conpty_set_size(conpty_t *conpty_object, uint16_t width, uint16_t height
|
|||||||
assert(height <= SHRT_MAX);
|
assert(height <= SHRT_MAX);
|
||||||
COORD size = { (int16_t)width, (int16_t)height };
|
COORD size = { (int16_t)width, (int16_t)height };
|
||||||
if (pResizePseudoConsole(conpty_object->pty, size) != S_OK) {
|
if (pResizePseudoConsole(conpty_object->pty, size) != S_OK) {
|
||||||
ELOG("ResizePseudoConsoel failed: error code: %d",
|
ELOG("ResizePseudoConsole failed: error code: %d",
|
||||||
os_translate_sys_error((int)GetLastError()));
|
os_translate_sys_error((int)GetLastError()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1030,6 +1030,11 @@ static int terminal_execute(VimState *state, int key)
|
|||||||
map_execute_lua(false, false);
|
map_execute_lua(false, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case K_IGNORE:
|
||||||
|
case K_NOP:
|
||||||
|
// Do not interrupt a Ctrl-\ sequence or close a finished terminal.
|
||||||
|
break;
|
||||||
|
|
||||||
case Ctrl_N:
|
case Ctrl_N:
|
||||||
if (s->got_bsl) {
|
if (s->got_bsl) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -1152,14 +1152,18 @@ describe('on_lines does not emit out-of-bounds line indexes when', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
describe('terminal input', function()
|
describe('terminal input', function()
|
||||||
|
local chan --- @type integer
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
exec_lua([[
|
chan = exec_lua(function()
|
||||||
_G.input_data = ''
|
_G.input_data = ''
|
||||||
vim.api.nvim_open_term(0, { on_input = function(_, _, _, data)
|
return vim.api.nvim_open_term(0, {
|
||||||
_G.input_data = _G.input_data .. data
|
on_input = function(_, _, _, data)
|
||||||
end })
|
_G.input_data = _G.input_data .. data
|
||||||
]])
|
end,
|
||||||
|
})
|
||||||
|
end)
|
||||||
feed('i')
|
feed('i')
|
||||||
poke_eventloop()
|
poke_eventloop()
|
||||||
end)
|
end)
|
||||||
@@ -1173,6 +1177,35 @@ describe('terminal input', function()
|
|||||||
feed('aaa<Help>bbb')
|
feed('aaa<Help>bbb')
|
||||||
eq('aaabbb', exec_lua([[return _G.input_data]]))
|
eq('aaabbb', exec_lua([[return _G.input_data]]))
|
||||||
end)
|
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)
|
end)
|
||||||
|
|
||||||
describe('terminal input', function()
|
describe('terminal input', function()
|
||||||
|
|||||||
Reference in New Issue
Block a user