{
modifiers = str[2];
str += 3;
- c = *str;
+
+ // Modifiers can be applied too to multi-byte characters.
+ p = mb_unescape(&str);
+
+ if (p == NULL)
+ c = *str;
+ else
+ {
+ // retrieve codepoint (character number) from unescaped string
+ c = (*mb_ptr2char)(p);
+ --str;
+ }
}
if (c == K_SPECIAL)
{
get_special_key_name(int c, int modifiers)
{
static char_u string[MAX_KEY_NAME_LEN + 1];
- int i, idx;
+ int i, idx, len;
int table_idx;
string[0] = '<';
// Not a special key, only modifiers, output directly
else
{
- if (has_mbyte && (*mb_char2len)(c) > 1)
- idx += (*mb_char2bytes)(c, string + idx);
- else if (vim_isprintc(c))
+ len = (*mb_char2len)(c);
+ if (len == 1 && vim_isprintc(c))
string[idx++] = c;
+ else if (has_mbyte && len > 1)
+ idx += (*mb_char2bytes)(c, string + idx);
else
{
char_u *s = transchar(c);
set sessionoptions& splitbelow& fileencoding&
endfunc
+func Test_session_multibyte_mappings()
+
+ " some characters readily available on european keyboards
+ let entries = [
+ \ ['n', '<M-ç>', '<M-ç>'],
+ \ ['n', '<M-º>', '<M-º>'],
+ \ ['n', '<M-¡>', '<M-¡>'],
+ \ ]
+ for entry in entries
+ exe entry[0] .. 'map ' .. entry[1] .. ' ' .. entry[2]
+ endfor
+
+ mkvimrc Xtestvimrc
+
+ nmapclear
+
+ for entry in entries
+ call assert_equal('', maparg(entry[1], entry[0]))
+ endfor
+
+ source Xtestvimrc
+
+ for entry in entries
+ call assert_equal(entry[2], maparg(entry[1], entry[0]))
+ endfor
+
+ nmapclear
+
+ call delete('Xtestvimrc')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1402,
/**/
1401,
/**/