diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2020-01-16 20:35:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-16 20:35:27 +0100 |
commit | 8fe0635e7338e32e8aedeb8f2e2c0f246876375c (patch) | |
tree | 0464fc18967fbcf1717c1fb29eae6be6945a4faa /src/nvim/message.c | |
parent | 6e78b2162382718b638c4532a155e5c3f9ed7515 (diff) | |
parent | b4a92aadd274c21a32baa68e2a460910ef9c77f5 (diff) | |
download | rneovim-8fe0635e7338e32e8aedeb8f2e2c0f246876375c.tar.gz rneovim-8fe0635e7338e32e8aedeb8f2e2c0f246876375c.tar.bz2 rneovim-8fe0635e7338e32e8aedeb8f2e2c0f246876375c.zip |
Merge pull request #11723 from bfredl/nocleareol
messages: echo "line1\r\nline2" should not clear line1
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) |