aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/message.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r--src/nvim/message.c21
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(' ');
}