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`
This commit is contained in:
nwounkn
2023-10-13 12:01:26 +05:00
committed by zeertzjq
parent ce0f80835a
commit 13f55750e9
4 changed files with 56 additions and 3 deletions

View File

@@ -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) { \

View File

@@ -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;

View File

@@ -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);