diff options
author | nwounkn <nwounkn@gmail.com> | 2023-10-13 12:01:26 +0500 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-10-14 14:23:08 +0800 |
commit | 13f55750e9bea8ec8f50550546edc64a0f0964d8 (patch) | |
tree | 741aa03b9f0d2edc53c210f5b9bebba251c8d9fb /src | |
parent | ce0f80835a5f6febd64f4ce5cf245d476ebaecfd (diff) | |
download | rneovim-13f55750e9bea8ec8f50550546edc64a0f0964d8.tar.gz rneovim-13f55750e9bea8ec8f50550546edc64a0f0964d8.tar.bz2 rneovim-13f55750e9bea8ec8f50550546edc64a0f0964d8.zip |
fix(ui): empty line before the next message after :silent command
Problem:
The next command after `silent !{cmd}` or `silent lua print('str')`
prints an empty line before printing a message, because these commands
set `msg_didout = true` despite not printing any messages.
Solution:
Set `msg_didout = true` only if `msg_silent == 0`
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/vim.c | 4 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 4 | ||||
-rw-r--r-- | src/nvim/lua/executor.c | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index ce3eca52b5..6ce1f41e39 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -1744,7 +1744,9 @@ static void write_msg(String message, bool to_err, bool writeln) } else { \ msg(line_buf->items, 0); \ } \ - 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 e9a42ae508..5ec4353e1d 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1346,7 +1346,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 d6fd14cc10..3975312703 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -955,7 +955,9 @@ static void nlua_print_event(void **argv) break; } msg(str + start, 0); - 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("", 0); |