summaryrefslogtreecommitdiffstats
path: root/src/message.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2011-08-17 20:33:22 +0200
committerBram Moolenaar <Bram@vim.org>2011-08-17 20:33:22 +0200
commitb8bf541f8944a9a0ea0a4b75f8d18a565f5d91d1 (patch)
treeedfac684d6d04e6566e4508fdeb24c70c6b44aef /src/message.c
parentf6f4a01ab15d6c962af1210d75a5dc3876e42f39 (diff)
updated for version 7.3.284v7.3.284
Problem: The str2special() function doesn't handle multi-byte characters properly. Solution: Recognize multi-byte characters. (partly by Vladimir Vichniakov)
Diffstat (limited to 'src/message.c')
-rw-r--r--src/message.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/message.c b/src/message.c
index 89248b4cf0..76bf69d6d7 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1547,16 +1547,27 @@ str2special(sp, from)
if (IS_SPECIAL(c) || modifiers) /* special key */
special = TRUE;
}
- *sp = str + 1;
#ifdef FEAT_MBYTE
- /* For multi-byte characters check for an illegal byte. */
- if (has_mbyte && MB_BYTE2LEN(*str) > (*mb_ptr2len)(str))
+ if (has_mbyte && !IS_SPECIAL(c))
{
- transchar_nonprint(buf, c);
- return buf;
+ int len = (*mb_ptr2len)(str);
+
+ /* For multi-byte characters check for an illegal byte. */
+ if (has_mbyte && MB_BYTE2LEN(*str) > len)
+ {
+ transchar_nonprint(buf, c);
+ *sp = str + 1;
+ return buf;
+ }
+ /* Since 'special' is TRUE the multi-byte character 'c' will be
+ * processed by get_special_key_name() */
+ c = (*mb_ptr2char)(str);
+ *sp = str + len;
}
+ else
#endif
+ *sp = str + 1;
/* Make unprintable characters in <> form, also <M-Space> and <Tab>.
* Use <Space> only for lhs of a mapping. */