mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 7.4.2209
Problem: Cannot map <M-">. (Stephen Riehm) Solution: Solve the memory access problem in another way. (Dominique Pelle) Allow for using <M-\"> in a string.
This commit is contained in:
34
src/misc2.c
34
src/misc2.c
@@ -2674,13 +2674,14 @@ get_special_key_name(int c, int modifiers)
|
||||
trans_special(
|
||||
char_u **srcp,
|
||||
char_u *dst,
|
||||
int keycode) /* prefer key code, e.g. K_DEL instead of DEL */
|
||||
int keycode, /* prefer key code, e.g. K_DEL instead of DEL */
|
||||
int in_string) /* TRUE when inside a double quoted string */
|
||||
{
|
||||
int modifiers = 0;
|
||||
int key;
|
||||
int dlen = 0;
|
||||
|
||||
key = find_special_key(srcp, &modifiers, keycode, FALSE);
|
||||
key = find_special_key(srcp, &modifiers, keycode, FALSE, in_string);
|
||||
if (key == 0)
|
||||
return 0;
|
||||
|
||||
@@ -2720,7 +2721,8 @@ find_special_key(
|
||||
char_u **srcp,
|
||||
int *modp,
|
||||
int keycode, /* prefer key code, e.g. K_DEL instead of DEL */
|
||||
int keep_x_key) /* don't translate xHome to Home key */
|
||||
int keep_x_key, /* don't translate xHome to Home key */
|
||||
int in_string) /* TRUE in string, double quote is escaped */
|
||||
{
|
||||
char_u *last_dash;
|
||||
char_u *end_of_name;
|
||||
@@ -2751,10 +2753,14 @@ find_special_key(
|
||||
else
|
||||
#endif
|
||||
l = 1;
|
||||
/* Anything accepted, like <C-?>, except <C-">, because the "
|
||||
* ends the string. */
|
||||
if (bp[l] != '"' && bp[l + 1] == '>')
|
||||
/* Anything accepted, like <C-?>.
|
||||
* <C-"> or <M-"> are not special in strings as " is
|
||||
* the string delimiter. With a backslash it works: <M-\"> */
|
||||
if (!(in_string && bp[1] == '"') && bp[2] == '>')
|
||||
bp += l;
|
||||
else if (in_string && bp[1] == '\\' && bp[2] == '"'
|
||||
&& bp[3] == '>')
|
||||
bp += 2;
|
||||
}
|
||||
}
|
||||
if (bp[0] == 't' && bp[1] == '_' && bp[2] && bp[3])
|
||||
@@ -2798,20 +2804,22 @@ find_special_key(
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Modifier with single letter, or special key name.
|
||||
*/
|
||||
int off = 1;
|
||||
|
||||
/* Modifier with single letter, or special key name. */
|
||||
if (in_string && last_dash[1] == '\\' && last_dash[2] == '"')
|
||||
off = 2;
|
||||
#ifdef FEAT_MBYTE
|
||||
if (has_mbyte)
|
||||
l = mb_ptr2len(last_dash + 1);
|
||||
l = mb_ptr2len(last_dash + off);
|
||||
else
|
||||
#endif
|
||||
l = 1;
|
||||
if (modifiers != 0 && last_dash[l + 1] == '>')
|
||||
key = PTR2CHAR(last_dash + 1);
|
||||
if (modifiers != 0 && last_dash[l + off] == '>')
|
||||
key = PTR2CHAR(last_dash + off);
|
||||
else
|
||||
{
|
||||
key = get_special_key_code(last_dash + 1);
|
||||
key = get_special_key_code(last_dash + off);
|
||||
if (!keep_x_key)
|
||||
key = handle_x_keys(key);
|
||||
}
|
||||
|
Reference in New Issue
Block a user