fix(messages): emit empty msg_show event for :echo #38467

Problem:  No empty msg_show event for :echo without arguments.
Solution: Emit empty msg_show event when :echo is invoked without arguments.
This commit is contained in:
luukvbaal
2026-03-24 15:47:12 +01:00
committed by GitHub
parent b2adfe775d
commit 81828e66b9
2 changed files with 5 additions and 2 deletions

View File

@@ -79,6 +79,7 @@
#include "nvim/strings.h"
#include "nvim/tag.h"
#include "nvim/types_defs.h"
#include "nvim/ui.h"
#include "nvim/undo.h"
#include "nvim/vim_defs.h"
#include "nvim/window.h"
@@ -6190,7 +6191,9 @@ void ex_echo(exarg_T *eap)
emsg_skip--;
} else {
// remove text that may still be there from the command
if (need_clear) {
if (ui_has(kUIMessages) && (*eap->arg == NUL || *eap->arg == '|' || *eap->arg == '\n')) {
msg_puts_len("", 0, 0, false); // emit "empty" kind msg_show
} else if (need_clear) {
msg_clr_eos();
}
if (eap->cmdidx == CMD_echo) {

View File

@@ -551,7 +551,7 @@ describe('ui/ext_messages', function()
})
-- 3 empty message events, not for an empty chunk after a non-printable character
feed(':echo "foo\\n" | echo "" | echom "" | lua print()<CR>')
feed(':echo "foo\\n" | echo | echom "" | lua print()<CR>')
screen:expect({
grid = [[
line 1 |