1
0
forked from aniani/vim

patch 8.0.1556: may not parse the t_RS response correctly

Problem:    May not parse the t_RS response correctly, resulting in wrong
            characters in the input stream.
Solution:   When the t_RS response is partly received wait for more
            characters.
This commit is contained in:
Bram Moolenaar
2018-03-02 20:58:42 +01:00
parent 77780b66f4
commit 590ec878a5
2 changed files with 36 additions and 23 deletions

View File

@@ -4866,7 +4866,7 @@ check_termcode(
* {tail} can be Esc>\ or STERM
*
* Check for cursor shape response from xterm:
* {lead}1$r<number> q{tail}
* {lead}1$r<digit> q{tail}
*
* {lead} can be <Esc>P or DCS
* {tail} can be Esc>\ or STERM
@@ -4897,14 +4897,23 @@ check_termcode(
break;
}
}
else if ((len >= j + 6 && isdigit(argp[3]))
&& argp[4] == ' '
&& argp[5] == 'q')
else
{
/* cursor shape response */
i = j + 6;
if ((tp[i] == ESC && i + 1 < len && tp[i + 1] == '\\')
|| tp[i] == STERM)
/* Probably the cursor shape response. Make sure that "i"
* is equal to "len" when there are not sufficient
* characters. */
for (i = j + 3; i < len; ++i)
{
if (i - j == 3 && !isdigit(tp[i]))
break;
if (i - j == 4 && tp[i] != ' ')
break;
if (i - j == 5 && tp[i] != 'q')
break;
if (i - j == 6 && tp[i] != ESC && tp[i] != STERM)
break;
if ((i - j == 6 && tp[i] == STERM)
|| (i - j == 7 && tp[i] == '\\'))
{
int number = argp[3] - '0';
@@ -4922,10 +4931,12 @@ check_termcode(
key_name[0] = (int)KS_EXTRA;
key_name[1] = (int)KE_IGNORE;
slen = i + 1 + (tp[i] == ESC);
slen = i + 1;
# ifdef FEAT_EVAL
set_vim_var_string(VV_TERMSTYLERESP, tp, slen);
# endif
break;
}
}
}

View File

@@ -778,6 +778,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1556,
/**/
1555,
/**/