aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/getchar.c2
-rw-r--r--test/functional/ex_cmds/normal_spec.lua13
2 files changed, 14 insertions, 1 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index b12b99b7ee..c944a5ec93 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -2330,7 +2330,7 @@ static int vgetorpeek(bool advance)
// cmdline window.
if (p_im && (State & INSERT)) {
c = Ctrl_L;
- } else if (exmode_active) {
+ } else if ((State & CMDLINE) && exmode_active) {
c = '\n';
} else if ((State & CMDLINE) || (cmdwin_type > 0 && tc == ESC)) {
c = Ctrl_C;
diff --git a/test/functional/ex_cmds/normal_spec.lua b/test/functional/ex_cmds/normal_spec.lua
new file mode 100644
index 0000000000..bc4e45ec62
--- /dev/null
+++ b/test/functional/ex_cmds/normal_spec.lua
@@ -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)