aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/message.c
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-04-21 00:33:12 +0300
committerZyX <kp-pav@yandex.ru>2017-04-21 00:33:12 +0300
commitd463c9e03a79e981faaaa985b1160c292d08e172 (patch)
tree8ebfb9bc003f76a6be2d84035c52c6fdd24afbb5 /src/nvim/message.c
parentc289986c89dd0189ed8ab709bf2eb822c493542a (diff)
parent19646a2985e54dfc561a90a70054522afc052a45 (diff)
downloadrneovim-d463c9e03a79e981faaaa985b1160c292d08e172.tar.gz
rneovim-d463c9e03a79e981faaaa985b1160c292d08e172.tar.bz2
rneovim-d463c9e03a79e981faaaa985b1160c292d08e172.zip
Merge branch 'master' into lazier-arg_errmsg-gettext
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r--src/nvim/message.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 3e4a1e10b6..146937c25a 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* message.c: functions for displaying messages on the command line
*/
@@ -1165,15 +1168,9 @@ int msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
* Normal characters are printed several at a time.
*/
while (--len >= 0) {
- if (enc_utf8) {
- // Don't include composing chars after the end.
- mb_l = utfc_ptr2len_len((char_u *)str, len + 1);
- } else if (has_mbyte) {
- mb_l = (*mb_ptr2len)((char_u *)str);
- } else {
- mb_l = 1;
- }
- if (has_mbyte && mb_l > 1) {
+ // Don't include composing chars after the end.
+ mb_l = utfc_ptr2len_len((char_u *)str, len + 1);
+ if (mb_l > 1) {
c = (*mb_ptr2char)((char_u *)str);
if (vim_isprintc(c)) {
// Printable multi-byte char: count the cells.
@@ -1663,16 +1660,13 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr,
// Display char in last column before showing more-prompt.
if (*s >= ' ' && !cmdmsg_rl) {
- if (has_mbyte) {
- 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);
- s = screen_puts_mbyte((char_u *)s, l, attr);
+ if (maxlen >= 0) {
+ // Avoid including composing chars after the end.
+ l = utfc_ptr2len_len(s, (int)((str + maxlen) - s));
} else {
- msg_screen_putchar(*s++, attr);
+ l = utfc_ptr2len(s);
}
+ s = screen_puts_mbyte((char_u *)s, l, attr);
did_last_char = true;
} else {
did_last_char = false;