mirror of
https://github.com/neovim/neovim.git
synced 2026-07-21 16:41:38 +00:00
fix(cmdline): avoid Ex-mode NULL cmdline_block event #39043
Problem: Attempting to emit cmdline_block event with NULL cmdbuff after
<C-\><C-N> in Ex-mode.
Solution: Don't emit cmdline_block event when cmdbuff is NULL.
(cherry picked from commit f0f9620b38)
This commit is contained in:
committed by
github-actions[bot]
parent
29684ca3cc
commit
4a18c05f87
@@ -1011,7 +1011,8 @@ theend:
|
|||||||
char *p = ccline.cmdbuff;
|
char *p = ccline.cmdbuff;
|
||||||
|
|
||||||
if (ui_has(kUICmdline)) {
|
if (ui_has(kUICmdline)) {
|
||||||
if (exmode_active) {
|
// Emit cmdline_block in Ex mode unless cmdbuff is NULL (happens with <C-\><C-N> #39021).
|
||||||
|
if (exmode_active && p != NULL) {
|
||||||
ui_ext_cmdline_block_append(0, p);
|
ui_ext_cmdline_block_append(0, p);
|
||||||
}
|
}
|
||||||
ui_ext_cmdline_hide(s->gotesc);
|
ui_ext_cmdline_hide(s->gotesc);
|
||||||
|
|||||||
@@ -822,12 +822,14 @@ local function test_cmdline(linegrid)
|
|||||||
cmdline = { { content = { { '' } }, firstc = ':', pos = 0 } },
|
cmdline = { { content = { { '' } }, firstc = ':', pos = 0 } },
|
||||||
cmdline_block = { { { 'echo "foo"' } } },
|
cmdline_block = { { { 'echo "foo"' } } },
|
||||||
})
|
})
|
||||||
feed('vis<CR>')
|
-- Shouldn't crash for NULL cmdline_block event after <C-\><C-N> #39021.
|
||||||
|
feed('<C-\\><C-N>vis<CR>')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|*3
|
{1:~ }|*3
|
||||||
|
|
|
|
||||||
]])
|
]])
|
||||||
|
assert_alive()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with :lua debug.debug()', function()
|
it('works with :lua debug.debug()', function()
|
||||||
|
|||||||
Reference in New Issue
Block a user