diff options
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r-- | src/nvim/message.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index 067f1c3283..94729dfd2a 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -228,7 +228,8 @@ int msg_attr(const char *s, const int attr) } /// similar to msg_outtrans_attr, but support newlines and tabs. -void msg_multiline_attr(const char *s, int attr, bool check_int) +void msg_multiline_attr(const char *s, int attr, + bool check_int, bool *need_clear) FUNC_ATTR_NONNULL_ALL { const char *next_spec = s; @@ -243,8 +244,9 @@ void msg_multiline_attr(const char *s, int attr, bool check_int) // Printing all char that are before the char found by strpbrk msg_outtrans_len_attr((const char_u *)s, next_spec - s, attr); - if (*next_spec != TAB) { + if (*next_spec != TAB && *need_clear) { msg_clr_eos(); + *need_clear = false; } msg_putchar_attr((uint8_t)(*next_spec), attr); s = next_spec + 1; @@ -256,6 +258,7 @@ void msg_multiline_attr(const char *s, int attr, bool check_int) if (*s != NUL) { msg_outtrans_attr((char_u *)s, attr); } + return; } @@ -314,12 +317,15 @@ bool msg_attr_keep(char_u *s, int attr, bool keep, bool multiline) if (buf != NULL) s = buf; + bool need_clear = true; if (multiline) { - msg_multiline_attr((char *)s, attr, false); + msg_multiline_attr((char *)s, attr, false, &need_clear); } else { msg_outtrans_attr(s, attr); } - msg_clr_eos(); + if (need_clear) { + msg_clr_eos(); + } retval = msg_end(); if (keep && retval && vim_strsize(s) < (int)(Rows - cmdline_row - 1) |