diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-11-19 22:57:13 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-11-19 22:57:13 +0000 |
commit | 9be89f131f87608f224f0ee06d199fcd09d32176 (patch) | |
tree | 11022dcfa9e08cb4ac5581b16734196128688d48 /src/nvim/message.c | |
parent | ff7ed8f586589d620a806c3758fac4a47a8e7e15 (diff) | |
parent | 88085c2e80a7e3ac29aabb6b5420377eed99b8b6 (diff) | |
download | rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.gz rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.bz2 rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.zip |
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r-- | src/nvim/message.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index 10b90bde29..79e6bc8be7 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -18,6 +18,7 @@ #include "nvim/channel.h" #include "nvim/charset.h" #include "nvim/drawscreen.h" +#include "nvim/errors.h" #include "nvim/eval.h" #include "nvim/eval/typval.h" #include "nvim/eval/typval_defs.h" @@ -445,9 +446,7 @@ void trunc_string(const char *s, char *buf, int room_in, int buflen) // Last part: End of the string. half = i = (int)strlen(s); while (true) { - do { - half = half - utf_head_off(s, s + half - 1) - 1; - } while (half > 0 && utf_iscomposing(utf_ptr2char(s + half))); + half = half - utf_head_off(s, s + half - 1) - 1; n = ptr2cells(s + half); if (len + n > room || half == 0) { break; @@ -1383,11 +1382,7 @@ void msgmore(int n) return; } - if (n > 0) { - pn = n; - } else { - pn = -n; - } + pn = abs(n); if (pn > p_report) { if (n > 0) { @@ -1425,9 +1420,7 @@ void msg_start(void) { bool did_return = false; - if (msg_row < cmdline_row) { - msg_row = cmdline_row; - } + msg_row = MAX(msg_row, cmdline_row); if (!msg_silent) { XFREE_CLEAR(keep_msg); // don't display old message now @@ -2689,7 +2682,7 @@ static void msg_puts_printf(const char *str, const ptrdiff_t maxlen) *p++ = '\r'; } memcpy(p, s, (size_t)len); - *(p + len) = '\0'; + *(p + len) = NUL; if (info_message) { printf("%s", buf); } else { @@ -3381,9 +3374,7 @@ void msg_advance(int col) } return; } - if (col >= Columns) { // not enough room - col = Columns - 1; - } + col = MIN(col, Columns - 1); // not enough room while (msg_col < col) { msg_putchar(' '); } |