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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 57f7369e73..689e8893bd 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -274,9 +274,9 @@ void trunc_string(char_u *s, char_u *buf, int room, int buflen)
for (;;) {
do {
half = half - (*mb_head_off)(s, s + half - 1) - 1;
- } while (utf_iscomposing(utf_ptr2char(s + half)) && half > 0);
+ } while (half > 0 && utf_iscomposing(utf_ptr2char(s + half)));
n = ptr2cells(s + half);
- if (len + n > room) {
+ if (len + n > room || half == 0) {
break;
}
len += n;