From a33e5fb1bbce06512b35b40b2cb04577a146f2aa Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Fri, 6 Feb 2026 14:10:33 +0100 Subject: [PATCH] fix(ui): cmdline_block events for exmode #37751 Problem: Exmode is missing cmdline_block events. Solution: Emit cmdline_block_show/append when executing a cmdline during exmode. Emit cmdline_block_hide when leaving exmode. --- src/nvim/ex_docmd.c | 3 +++ src/nvim/ex_getln.c | 3 +++ test/functional/ui/cmdline_spec.lua | 32 +++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 6fcdc95532..e6d6479be8 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -5925,6 +5925,9 @@ void do_exedit(exarg_T *eap, win_T *old_curwin) || eap->cmdidx == CMD_view)) { exmode_active = false; ex_pressedreturn = false; + if (ui_has(kUICmdline)) { + ui_ext_cmdline_block_leave(); + } if (*eap->arg == NUL) { // Special case: ":global/pat/visual\NLvi-commands" if (global_busy) { diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index fa44cc074f..1e210327ca 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -1006,6 +1006,9 @@ theend: char *p = ccline.cmdbuff; if (ui_has(kUICmdline)) { + if (exmode_active) { + ui_ext_cmdline_block_append(0, p); + } ui_ext_cmdline_hide(s->gotesc); } if (!cmd_silent) { diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index f573e586b6..36cbcd8b2c 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -797,6 +797,38 @@ local function test_cmdline(linegrid) | ]]) end) + + it('works with exmode', function() + feed('gQ') + screen:expect({ + grid = [[ + | + {3: }| + Entering Ex mode. Type "| + visual" to go to Normal m| + ode.^ | + ]], + cmdline = { { content = { { '' } }, firstc = ':', pos = 0 } }, + }) + feed('echo "foo"') + screen:expect({ + grid = [[ + {3: }| + Entering Ex mode. Type "| + visual" to go to Normal m| + ode. | + foo^ | + ]], + cmdline = { { content = { { '' } }, firstc = ':', pos = 0 } }, + cmdline_block = { { { 'echo "foo"' } } }, + }) + feed('vis') + screen:expect([[ + ^ | + {1:~ }|*3 + | + ]]) + end) end -- the representation of cmdline and cmdline_block contents changed with ext_linegrid