From 1a3d3b77bb8d4a4c7b52cbd0b23f6b56772bae0b Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Thu, 29 Jan 2026 22:51:58 +0100 Subject: [PATCH] fix(ui): no empty message for substitution match with ext_messages #37600 Problem: Empty message is emitted when a match is found. Solution: Don't emit it with ext_messages enabled. --- src/nvim/ex_cmds.c | 2 +- test/functional/ui/cmdline2_spec.lua | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 5bbec56f2b..ced6ab3d7d 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -4527,7 +4527,7 @@ skip: emsg(_(e_interr)); } else if (got_match) { // did find something but nothing substituted - if (p_ch > 0) { + if (p_ch > 0 && !ui_has(kUIMessages)) { msg("", 0); } } else if (subflags.do_error) { diff --git a/test/functional/ui/cmdline2_spec.lua b/test/functional/ui/cmdline2_spec.lua index c1980eb986..a6a1d99535 100644 --- a/test/functional/ui/cmdline2_spec.lua +++ b/test/functional/ui/cmdline2_spec.lua @@ -170,6 +170,16 @@ describe('cmdline2', function() ]]) t.eq(n.eval('v:errmsg'), "E1514: 'findfunc' did not return a List type") end) + + it('substitution match does not clear cmdline', function() + exec('call setline(1, "foo")') + feed(':s/f') + screen:expect([[ + {10:f}oo | + {1:~ }|*12 + {16::}{15:s}{16:/f}^ | + ]]) + end) end) describe('cmdline2', function()