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:
57
src/term.c
57
src/term.c
@@ -4866,7 +4866,7 @@ check_termcode(
|
|||||||
* {tail} can be Esc>\ or STERM
|
* {tail} can be Esc>\ or STERM
|
||||||
*
|
*
|
||||||
* Check for cursor shape response from xterm:
|
* 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
|
* {lead} can be <Esc>P or DCS
|
||||||
* {tail} can be Esc>\ or STERM
|
* {tail} can be Esc>\ or STERM
|
||||||
@@ -4897,35 +4897,46 @@ check_termcode(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((len >= j + 6 && isdigit(argp[3]))
|
else
|
||||||
&& argp[4] == ' '
|
|
||||||
&& argp[5] == 'q')
|
|
||||||
{
|
{
|
||||||
/* cursor shape response */
|
/* Probably the cursor shape response. Make sure that "i"
|
||||||
i = j + 6;
|
* is equal to "len" when there are not sufficient
|
||||||
if ((tp[i] == ESC && i + 1 < len && tp[i + 1] == '\\')
|
* characters. */
|
||||||
|| tp[i] == STERM)
|
for (i = j + 3; i < len; ++i)
|
||||||
{
|
{
|
||||||
int number = argp[3] - '0';
|
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';
|
||||||
|
|
||||||
/* 0, 1 = block blink, 2 = block
|
/* 0, 1 = block blink, 2 = block
|
||||||
* 3 = underline blink, 4 = underline
|
* 3 = underline blink, 4 = underline
|
||||||
* 5 = vertical bar blink, 6 = vertical bar */
|
* 5 = vertical bar blink, 6 = vertical bar */
|
||||||
number = number == 0 ? 1 : number;
|
number = number == 0 ? 1 : number;
|
||||||
initial_cursor_shape = (number + 1) / 2;
|
initial_cursor_shape = (number + 1) / 2;
|
||||||
/* The blink flag is actually inverted, compared to
|
/* The blink flag is actually inverted, compared to
|
||||||
* the value set with T_SH. */
|
* the value set with T_SH. */
|
||||||
initial_cursor_shape_blink =
|
initial_cursor_shape_blink =
|
||||||
(number & 1) ? FALSE : TRUE;
|
(number & 1) ? FALSE : TRUE;
|
||||||
rcs_status = STATUS_GOT;
|
rcs_status = STATUS_GOT;
|
||||||
LOG_TR("Received cursor shape response");
|
LOG_TR("Received cursor shape response");
|
||||||
|
|
||||||
key_name[0] = (int)KS_EXTRA;
|
key_name[0] = (int)KS_EXTRA;
|
||||||
key_name[1] = (int)KE_IGNORE;
|
key_name[1] = (int)KE_IGNORE;
|
||||||
slen = i + 1 + (tp[i] == ESC);
|
slen = i + 1;
|
||||||
# ifdef FEAT_EVAL
|
# ifdef FEAT_EVAL
|
||||||
set_vim_var_string(VV_TERMSTYLERESP, tp, slen);
|
set_vim_var_string(VV_TERMSTYLERESP, tp, slen);
|
||||||
# endif
|
# endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -778,6 +778,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 */
|
||||||
|
/**/
|
||||||
|
1556,
|
||||||
/**/
|
/**/
|
||||||
1555,
|
1555,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user