diff options
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r-- | src/nvim/message.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index 30e906cd5f..067f1c3283 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -233,12 +233,15 @@ void msg_multiline_attr(const char *s, int attr, bool check_int) { const char *next_spec = s; - while (next_spec != NULL && (!check_int || !got_int)) { + while (next_spec != NULL) { + if (check_int && got_int) { + return; + } next_spec = strpbrk(s, "\t\n\r"); if (next_spec != NULL) { // Printing all char that are before the char found by strpbrk - msg_outtrans_len_attr((char_u *)s, next_spec - s, attr); + msg_outtrans_len_attr((const char_u *)s, next_spec - s, attr); if (*next_spec != TAB) { msg_clr_eos(); @@ -1375,7 +1378,7 @@ static void msg_home_replace_attr(char_u *fname, int attr) /* * Output 'len' characters in 'str' (including NULs) with translation - * if 'len' is -1, output upto a NUL character. + * if 'len' is -1, output up to a NUL character. * Use attributes 'attr'. * Return the number of characters it takes on the screen. */ @@ -1384,12 +1387,12 @@ int msg_outtrans(char_u *str) return msg_outtrans_attr(str, 0); } -int msg_outtrans_attr(char_u *str, int attr) +int msg_outtrans_attr(const char_u *str, int attr) { return msg_outtrans_len_attr(str, (int)STRLEN(str), attr); } -int msg_outtrans_len(char_u *str, int len) +int msg_outtrans_len(const char_u *str, int len) { return msg_outtrans_len_attr(str, len, 0); } @@ -1402,7 +1405,7 @@ char_u *msg_outtrans_one(char_u *p, int attr) { int l; - if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) { + if ((l = utfc_ptr2len(p)) > 1) { msg_outtrans_len_attr(p, l, attr); return p + l; } @@ -1410,7 +1413,7 @@ char_u *msg_outtrans_one(char_u *p, int attr) return p + 1; } -int msg_outtrans_len_attr(char_u *msgstr, int len, int attr) +int msg_outtrans_len_attr(const char_u *msgstr, int len, int attr) { int retval = 0; const char *str = (const char *)msgstr; @@ -1498,7 +1501,7 @@ void msg_make(char_u *arg) } } -/// Output the string 'str' upto a NUL character. +/// Output the string 'str' up to a NUL character. /// Return the number of characters it takes on the screen. /// /// If K_SPECIAL is encountered, then it is taken in conjunction with the |