mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
updated for version 7.3.091
Problem: "vim -w foo" writes special key codes for removed escape sequences. (Josh Triplett) Solution: Don't write K_IGNORE codes.
This commit is contained in:
@@ -1506,9 +1506,6 @@ updatescript(c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define KL_PART_KEY -1 /* keylen value for incomplete key-code */
|
|
||||||
#define KL_PART_MAP -2 /* keylen value for incomplete mapping */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the next input character.
|
* Get the next input character.
|
||||||
* Can return a special key or a multi-byte character.
|
* Can return a special key or a multi-byte character.
|
||||||
@@ -2171,7 +2168,7 @@ vgetorpeek(advance)
|
|||||||
if (!timedout)
|
if (!timedout)
|
||||||
{
|
{
|
||||||
/* break at a partly match */
|
/* break at a partly match */
|
||||||
keylen = KL_PART_MAP;
|
keylen = KEYLEN_PART_MAP;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2192,7 +2189,7 @@ vgetorpeek(advance)
|
|||||||
|
|
||||||
/* If no partly match found, use the longest full
|
/* If no partly match found, use the longest full
|
||||||
* match. */
|
* match. */
|
||||||
if (keylen != KL_PART_MAP)
|
if (keylen != KEYLEN_PART_MAP)
|
||||||
{
|
{
|
||||||
mp = mp_match;
|
mp = mp_match;
|
||||||
keylen = mp_match_len;
|
keylen = mp_match_len;
|
||||||
@@ -2230,7 +2227,7 @@ vgetorpeek(advance)
|
|||||||
}
|
}
|
||||||
/* Need more chars for partly match. */
|
/* Need more chars for partly match. */
|
||||||
if (mlen == typebuf.tb_len)
|
if (mlen == typebuf.tb_len)
|
||||||
keylen = KL_PART_KEY;
|
keylen = KEYLEN_PART_KEY;
|
||||||
else if (max_mlen < mlen)
|
else if (max_mlen < mlen)
|
||||||
/* no match, may have to check for termcode at
|
/* no match, may have to check for termcode at
|
||||||
* next character */
|
* next character */
|
||||||
@@ -2238,7 +2235,7 @@ vgetorpeek(advance)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((mp == NULL || max_mlen >= mp_match_len)
|
if ((mp == NULL || max_mlen >= mp_match_len)
|
||||||
&& keylen != KL_PART_MAP)
|
&& keylen != KEYLEN_PART_MAP)
|
||||||
{
|
{
|
||||||
int save_keylen = keylen;
|
int save_keylen = keylen;
|
||||||
|
|
||||||
@@ -2264,8 +2261,8 @@ vgetorpeek(advance)
|
|||||||
/* If no termcode matched but 'pastetoggle'
|
/* If no termcode matched but 'pastetoggle'
|
||||||
* matched partially it's like an incomplete key
|
* matched partially it's like an incomplete key
|
||||||
* sequence. */
|
* sequence. */
|
||||||
if (keylen == 0 && save_keylen == KL_PART_KEY)
|
if (keylen == 0 && save_keylen == KEYLEN_PART_KEY)
|
||||||
keylen = KL_PART_KEY;
|
keylen = KEYLEN_PART_KEY;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When getting a partial match, but the last
|
* When getting a partial match, but the last
|
||||||
@@ -2302,7 +2299,7 @@ vgetorpeek(advance)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (*s == NUL) /* need more characters */
|
if (*s == NUL) /* need more characters */
|
||||||
keylen = KL_PART_KEY;
|
keylen = KEYLEN_PART_KEY;
|
||||||
}
|
}
|
||||||
if (keylen >= 0)
|
if (keylen >= 0)
|
||||||
#endif
|
#endif
|
||||||
@@ -2339,7 +2336,8 @@ vgetorpeek(advance)
|
|||||||
if (keylen > 0) /* full matching terminal code */
|
if (keylen > 0) /* full matching terminal code */
|
||||||
{
|
{
|
||||||
#if defined(FEAT_GUI) && defined(FEAT_MENU)
|
#if defined(FEAT_GUI) && defined(FEAT_MENU)
|
||||||
if (typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL
|
if (typebuf.tb_len >= 2
|
||||||
|
&& typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL
|
||||||
&& typebuf.tb_buf[typebuf.tb_off + 1]
|
&& typebuf.tb_buf[typebuf.tb_off + 1]
|
||||||
== KS_MENU)
|
== KS_MENU)
|
||||||
{
|
{
|
||||||
@@ -2381,7 +2379,7 @@ vgetorpeek(advance)
|
|||||||
/* Partial match: get some more characters. When a
|
/* Partial match: get some more characters. When a
|
||||||
* matching mapping was found use that one. */
|
* matching mapping was found use that one. */
|
||||||
if (mp == NULL || keylen < 0)
|
if (mp == NULL || keylen < 0)
|
||||||
keylen = KL_PART_KEY;
|
keylen = KEYLEN_PART_KEY;
|
||||||
else
|
else
|
||||||
keylen = mp_match_len;
|
keylen = mp_match_len;
|
||||||
}
|
}
|
||||||
@@ -2553,7 +2551,8 @@ vgetorpeek(advance)
|
|||||||
#endif
|
#endif
|
||||||
&& typebuf.tb_maplen == 0
|
&& typebuf.tb_maplen == 0
|
||||||
&& (State & INSERT)
|
&& (State & INSERT)
|
||||||
&& (p_timeout || (keylen == KL_PART_KEY && p_ttimeout))
|
&& (p_timeout
|
||||||
|
|| (keylen == KEYLEN_PART_KEY && p_ttimeout))
|
||||||
&& (c = inchar(typebuf.tb_buf + typebuf.tb_off
|
&& (c = inchar(typebuf.tb_buf + typebuf.tb_off
|
||||||
+ typebuf.tb_len, 3, 25L,
|
+ typebuf.tb_len, 3, 25L,
|
||||||
typebuf.tb_change_cnt)) == 0)
|
typebuf.tb_change_cnt)) == 0)
|
||||||
@@ -2783,9 +2782,9 @@ vgetorpeek(advance)
|
|||||||
? 0
|
? 0
|
||||||
: ((typebuf.tb_len == 0
|
: ((typebuf.tb_len == 0
|
||||||
|| !(p_timeout || (p_ttimeout
|
|| !(p_timeout || (p_ttimeout
|
||||||
&& keylen == KL_PART_KEY)))
|
&& keylen == KEYLEN_PART_KEY)))
|
||||||
? -1L
|
? -1L
|
||||||
: ((keylen == KL_PART_KEY && p_ttm >= 0)
|
: ((keylen == KEYLEN_PART_KEY && p_ttm >= 0)
|
||||||
? p_ttm
|
? p_ttm
|
||||||
: p_tm)), typebuf.tb_change_cnt);
|
: p_tm)), typebuf.tb_change_cnt);
|
||||||
|
|
||||||
|
@@ -3114,8 +3114,9 @@ get_keystroke()
|
|||||||
&& (!p_ttimeout || waited * 100L < (p_ttm < 0 ? p_tm : p_ttm)))
|
&& (!p_ttimeout || waited * 100L < (p_ttm < 0 ? p_tm : p_ttm)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* found a termcode: adjust length */
|
if (n == KEYLEN_REMOVED) /* key code removed */
|
||||||
if (n > 0)
|
continue;
|
||||||
|
if (n > 0) /* found a termcode: adjust length */
|
||||||
len = n;
|
len = n;
|
||||||
if (len == 0) /* nothing typed yet */
|
if (len == 0) /* nothing typed yet */
|
||||||
continue;
|
continue;
|
||||||
|
11
src/term.c
11
src/term.c
@@ -3828,6 +3828,7 @@ set_mouse_topline(wp)
|
|||||||
* Check from typebuf.tb_buf[typebuf.tb_off] to typebuf.tb_buf[typebuf.tb_off
|
* Check from typebuf.tb_buf[typebuf.tb_off] to typebuf.tb_buf[typebuf.tb_off
|
||||||
* + max_offset].
|
* + max_offset].
|
||||||
* Return 0 for no match, -1 for partial match, > 0 for full match.
|
* Return 0 for no match, -1 for partial match, > 0 for full match.
|
||||||
|
* Return KEYLEN_REMOVED when a key code was deleted.
|
||||||
* With a match, the match is removed, the replacement code is inserted in
|
* With a match, the match is removed, the replacement code is inserted in
|
||||||
* typebuf.tb_buf[] and the number of characters in typebuf.tb_buf[] is
|
* typebuf.tb_buf[] and the number of characters in typebuf.tb_buf[] is
|
||||||
* returned.
|
* returned.
|
||||||
@@ -3845,6 +3846,7 @@ check_termcode(max_offset, buf, buflen)
|
|||||||
int slen = 0; /* init for GCC */
|
int slen = 0; /* init for GCC */
|
||||||
int modslen;
|
int modslen;
|
||||||
int len;
|
int len;
|
||||||
|
int retval = 0;
|
||||||
int offset;
|
int offset;
|
||||||
char_u key_name[2];
|
char_u key_name[2];
|
||||||
int modifiers;
|
int modifiers;
|
||||||
@@ -4940,6 +4942,13 @@ check_termcode(max_offset, buf, buflen)
|
|||||||
#endif
|
#endif
|
||||||
string[new_slen++] = key_name[1];
|
string[new_slen++] = key_name[1];
|
||||||
}
|
}
|
||||||
|
else if (new_slen == 0 && key_name[0] == KS_EXTRA
|
||||||
|
&& key_name[1] == KE_IGNORE)
|
||||||
|
{
|
||||||
|
/* Do not put K_IGNORE into the buffer, do return KEYLEN_REMOVED
|
||||||
|
* to indicate what happened. */
|
||||||
|
retval = KEYLEN_REMOVED;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string[new_slen++] = K_SPECIAL;
|
string[new_slen++] = K_SPECIAL;
|
||||||
@@ -4976,7 +4985,7 @@ check_termcode(max_offset, buf, buflen)
|
|||||||
(size_t)(buflen - offset));
|
(size_t)(buflen - offset));
|
||||||
mch_memmove(buf + offset, string, (size_t)new_slen);
|
mch_memmove(buf + offset, string, (size_t)new_slen);
|
||||||
}
|
}
|
||||||
return (len + extra + offset);
|
return retval == 0 ? (len + extra + offset) : retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0; /* no match found */
|
return 0; /* no match found */
|
||||||
|
@@ -714,6 +714,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
91,
|
||||||
/**/
|
/**/
|
||||||
90,
|
90,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -2211,4 +2211,8 @@ typedef int VimClipboard; /* This is required for the prototypes. */
|
|||||||
#define MSCR_LEFT -1
|
#define MSCR_LEFT -1
|
||||||
#define MSCR_RIGHT -2
|
#define MSCR_RIGHT -2
|
||||||
|
|
||||||
|
#define KEYLEN_PART_KEY -1 /* keylen value for incomplete key-code */
|
||||||
|
#define KEYLEN_PART_MAP -2 /* keylen value for incomplete mapping */
|
||||||
|
#define KEYLEN_REMOVED 9999 /* keylen value for removed sequence */
|
||||||
|
|
||||||
#endif /* VIM__H */
|
#endif /* VIM__H */
|
||||||
|
Reference in New Issue
Block a user