aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-02-27 10:02:04 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2018-03-04 08:37:57 +0100
commitcee9a8ce8a0a6bfdadec7f95466bec73a8cc0bdc (patch)
tree3127d25e8b2e12b7a0ec54e784996e5fa5ca9dda /src
parenta98736b9c0f3b5a860ab030853c04427d2da64cd (diff)
downloadrneovim-cee9a8ce8a0a6bfdadec7f95466bec73a8cc0bdc.tar.gz
rneovim-cee9a8ce8a0a6bfdadec7f95466bec73a8cc0bdc.tar.bz2
rneovim-cee9a8ce8a0a6bfdadec7f95466bec73a8cc0bdc.zip
message: don't output unprintable chars to screen
fixes #7586 #8070
Diffstat (limited to 'src')
-rw-r--r--src/nvim/message.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 1d9a4de9c0..e522670a65 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -1825,17 +1825,13 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr,
} while (msg_col & 7);
} else if (*s == BELL) { // beep (from ":sh")
vim_beep(BO_SH);
- } else {
- if (has_mbyte) {
- cw = (*mb_ptr2cells)(s);
- if (enc_utf8 && maxlen >= 0)
- /* avoid including composing chars after the end */
- l = utfc_ptr2len_len(s, (int)((str + maxlen) - s));
- else
- l = (*mb_ptr2len)(s);
+ } else if (*s >= 0x20) { // printable char
+ cw = mb_ptr2cells(s);
+ if (maxlen >= 0) {
+ // avoid including composing chars after the end
+ l = utfc_ptr2len_len(s, (int)((str + maxlen) - s));
} else {
- cw = 1;
- l = 1;
+ l = utfc_ptr2len(s);
}
// When drawing from right to left or when a double-wide character
// doesn't fit, draw a single character here. Otherwise collect