diff options
author | James McCoy <jamessan@jamessan.com> | 2017-03-06 14:29:26 -0500 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2017-03-06 15:36:14 -0500 |
commit | 532197b4f95596e202fb230523ceb0c9e6233dae (patch) | |
tree | 74da61019579e0155cccbdced6eb443191a458b0 | |
parent | 52e56954c6fa211246a55f7877986473d21a238b (diff) | |
download | rneovim-532197b4f95596e202fb230523ceb0c9e6233dae.tar.gz rneovim-532197b4f95596e202fb230523ceb0c9e6233dae.tar.bz2 rneovim-532197b4f95596e202fb230523ceb0c9e6233dae.zip |
lint
-rw-r--r-- | src/nvim/message.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index 9d9bed2c1f..4cd0db21e8 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -259,8 +259,9 @@ void trunc_string(char_u *s, char_u *buf, int room_in, int buflen) return; } n = ptr2cells(s + e); - if (len + n > half) + if (len + n > half) { break; + } len += n; buf[e] = s[e]; if (has_mbyte) @@ -303,8 +304,9 @@ void trunc_string(char_u *s, char_u *buf, int room_in, int buflen) // set the middle and copy the last part memmove(buf + e, "...", (size_t)3); len = STRLEN(s + i) + 1; - if (len >= (size_t)buflen - e - 3) + if (len >= (size_t)buflen - e - 3) { len = buflen - e - 3 - 1; + } memmove(buf + e + 3, s + i, len); buf[e + 3 + len - 1] = NUL; } else { |