mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 08:18:17 +00:00
messages: echo "line1\r\nline2" should not clear line1
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user