diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 51ef1b85f3..0fed809fa5 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1339,7 +1339,7 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char *cmd, b goto filterend; } - if (!do_out) { + if (!do_out && !ui_has(kUIMessages)) { msg_putchar('\n'); } @@ -1446,7 +1446,9 @@ error: // put cursor back in same position for ":w !cmd" curwin->w_cursor = cursor_save; no_wait_return--; - wait_return(false); + if (!ui_has(kUIMessages)) { + wait_return(false); + } } filterend: diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index 056d1d4961..6ee5ef648c 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -729,7 +729,9 @@ int call_shell(char *cmd, int opts, char *extra_shell_arg) if (p_verbose > 3) { verbose_enter(); smsg(0, _("Executing command: \"%s\""), cmd == NULL ? p_sh : cmd); - msg_putchar('\n'); + if (!ui_has(kUIMessages)) { + msg_putchar('\n'); + } verbose_leave(); } diff --git a/test/functional/ui/messages2_spec.lua b/test/functional/ui/messages2_spec.lua index 9ae5480866..dec397e5e4 100644 --- a/test/functional/ui/messages2_spec.lua +++ b/test/functional/ui/messages2_spec.lua @@ -383,6 +383,16 @@ describe('messages2', function() ]]) end) + it('no prompt and newlines with Visual filter command #38273', function() + set_msg_target_zero_ch() + feed('V:w !printf foo') + screen:expect([[ + ^ | + {1:~ }|*12 + {1:~ }{4:foo}| + ]]) + end) + it('empty kind after message that does not flush immediately', function() command('echon "foo" | echo') screen:expect([[