diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index da725233ff..e5321bee37 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -1689,7 +1689,9 @@ static void write_msg(String message, bool to_err, bool writeln) if (c == NL) { \ kv_push(line_buf, NUL); \ msg(line_buf.items); \ - msg_didout = true; \ + if (msg_silent == 0) { \ + msg_didout = true; \ + } \ kv_drop(line_buf, kv_size(line_buf)); \ kv_resize(line_buf, LINE_BUFFER_MIN_SIZE); \ } else if (c == NUL) { \ diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 4d882ef73b..9f867ea048 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1319,7 +1319,9 @@ void do_shell(char *cmd, int flags) // 1" command to the terminal. ui_cursor_goto(msg_row, msg_col); (void)call_shell(cmd, (ShellOpts)flags, NULL); - msg_didout = true; + if (msg_silent == 0) { + msg_didout = true; + } did_check_timestamps = false; need_check_timestamps = true; diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index e489b0f058..5c1ba3f9fc 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -944,7 +944,9 @@ static void nlua_print_event(void **argv) break; } msg(str + start); - msg_didout = true; // Make blank lines work properly + if (msg_silent == 0) { + msg_didout = true; // Make blank lines work properly + } } if (len && str[len - 1] == NUL) { // Last was newline msg(""); diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index 5220f3fa89..93eacf1fd2 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -1030,6 +1030,53 @@ vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vim -- luacheck: pop end) + it('no empty line after :silent #12099', function() + exec([[ + func T1() + silent !echo + echo "message T1" + endfunc + func T2() + silent lua print("lua message") + echo "message T2" + endfunc + func T3() + silent call nvim_out_write("api message\n") + echo "message T3" + endfunc + ]]) + feed(':call T1()') + screen:expect{grid=[[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + message T1 | + ]]} + feed(':call T2()') + screen:expect{grid=[[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + message T2 | + ]]} + feed(':call T3()') + screen:expect{grid=[[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + message T3 | + ]]} + end) + it('supports ruler with laststatus=0', function() command("set ruler laststatus=0") screen:expect{grid=[[