mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 05:58:33 +00:00
fix(ex_normal): spam \n in Ex mode only if in Cmdline mode (#17977)
When using :normal in Ex mode, the editor is no longer in Cmdline mode, but the exmode_active flag is still set, causing the wrong character to be spammed in Insert mode, leading to a hang.
This commit is contained in:
@@ -2330,7 +2330,7 @@ static int vgetorpeek(bool advance)
|
|||||||
// cmdline window.
|
// cmdline window.
|
||||||
if (p_im && (State & INSERT)) {
|
if (p_im && (State & INSERT)) {
|
||||||
c = Ctrl_L;
|
c = Ctrl_L;
|
||||||
} else if (exmode_active) {
|
} else if ((State & CMDLINE) && exmode_active) {
|
||||||
c = '\n';
|
c = '\n';
|
||||||
} else if ((State & CMDLINE) || (cmdwin_type > 0 && tc == ESC)) {
|
} else if ((State & CMDLINE) || (cmdwin_type > 0 && tc == ESC)) {
|
||||||
c = Ctrl_C;
|
c = Ctrl_C;
|
||||||
|
13
test/functional/ex_cmds/normal_spec.lua
Normal file
13
test/functional/ex_cmds/normal_spec.lua
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
local clear = helpers.clear
|
||||||
|
local feed = helpers.feed
|
||||||
|
local expect = helpers.expect
|
||||||
|
|
||||||
|
before_each(clear)
|
||||||
|
|
||||||
|
describe(':normal', function()
|
||||||
|
it('can get out of Insert mode if called from Ex mode #17924', function()
|
||||||
|
feed('gQnormal! Ifoo<CR>')
|
||||||
|
expect('foo')
|
||||||
|
end)
|
||||||
|
end)
|
Reference in New Issue
Block a user