mirror of
https://github.com/vim/vim.git
synced 2025-09-28 04:24:06 -04:00
patch 8.1.1469: no test for checking the cursor style response
Problem: No test for checking the cursor style response. Solution: Add a simple test. Also include the missing part of 8.1.1464.
This commit is contained in:
49
src/term.c
49
src/term.c
@@ -4015,7 +4015,8 @@ term_cursor_color(char_u *color)
|
|||||||
blink_state_is_inverted()
|
blink_state_is_inverted()
|
||||||
{
|
{
|
||||||
#ifdef FEAT_TERMRESPONSE
|
#ifdef FEAT_TERMRESPONSE
|
||||||
return rbm_status.tr_progress == STATUS_GOT && rcs_status.tr_progress == STATUS_GOT
|
return rbm_status.tr_progress == STATUS_GOT
|
||||||
|
&& rcs_status.tr_progress == STATUS_GOT
|
||||||
&& initial_cursor_blink != initial_cursor_shape_blink;
|
&& initial_cursor_blink != initial_cursor_shape_blink;
|
||||||
#else
|
#else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -5062,7 +5063,7 @@ check_termcode(
|
|||||||
* {lead}1$r<digit> 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
|
||||||
*
|
*
|
||||||
* Consume any code that starts with "{lead}.+r" or "{lead}.$r".
|
* Consume any code that starts with "{lead}.+r" or "{lead}.$r".
|
||||||
*/
|
*/
|
||||||
@@ -5072,29 +5073,29 @@ check_termcode(
|
|||||||
{
|
{
|
||||||
j = 1 + (tp[0] == ESC);
|
j = 1 + (tp[0] == ESC);
|
||||||
if (len < j + 3)
|
if (len < j + 3)
|
||||||
i = len; /* need more chars */
|
i = len; // need more chars
|
||||||
else if ((argp[1] != '+' && argp[1] != '$') || argp[2] != 'r')
|
else if ((argp[1] != '+' && argp[1] != '$') || argp[2] != 'r')
|
||||||
i = 0; /* no match */
|
i = 0; // no match
|
||||||
else if (argp[1] == '+')
|
else if (argp[1] == '+')
|
||||||
/* key code response */
|
// key code response
|
||||||
for (i = j; i < len; ++i)
|
for (i = j; i < len; ++i)
|
||||||
{
|
|
||||||
if ((tp[i] == ESC && i + 1 < len && tp[i + 1] == '\\')
|
|
||||||
|| tp[i] == STERM)
|
|
||||||
{
|
{
|
||||||
if (i - j >= 3)
|
if ((tp[i] == ESC && i + 1 < len && tp[i + 1] == '\\')
|
||||||
got_code_from_term(tp + j, i);
|
|| tp[i] == STERM)
|
||||||
key_name[0] = (int)KS_EXTRA;
|
{
|
||||||
key_name[1] = (int)KE_IGNORE;
|
if (i - j >= 3)
|
||||||
slen = i + 1 + (tp[i] == ESC);
|
got_code_from_term(tp + j, i);
|
||||||
break;
|
key_name[0] = (int)KS_EXTRA;
|
||||||
|
key_name[1] = (int)KE_IGNORE;
|
||||||
|
slen = i + 1 + (tp[i] == ESC);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Probably the cursor shape response. Make sure that "i"
|
// Probably the cursor shape response. Make sure that "i"
|
||||||
* is equal to "len" when there are not sufficient
|
// is equal to "len" when there are not sufficient
|
||||||
* characters. */
|
// characters.
|
||||||
for (i = j + 3; i < len; ++i)
|
for (i = j + 3; i < len; ++i)
|
||||||
{
|
{
|
||||||
if (i - j == 3 && !isdigit(tp[i]))
|
if (i - j == 3 && !isdigit(tp[i]))
|
||||||
@@ -5110,13 +5111,13 @@ check_termcode(
|
|||||||
{
|
{
|
||||||
int number = argp[3] - '0';
|
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.tr_progress = STATUS_GOT;
|
rcs_status.tr_progress = STATUS_GOT;
|
||||||
|
@@ -624,3 +624,63 @@ func Test_xterm_mouse_click_in_fold_columns()
|
|||||||
let &mouse = save_mouse
|
let &mouse = save_mouse
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" This only checks if the sequence is recognized.
|
||||||
|
" TODO: check that the values were parsed properly
|
||||||
|
func Test_term_rgb_response()
|
||||||
|
set t_RF=x
|
||||||
|
set t_RB=y
|
||||||
|
|
||||||
|
" response to t_RF, 4 digits
|
||||||
|
let red = 0x12
|
||||||
|
let green = 0x34
|
||||||
|
let blue = 0x56
|
||||||
|
let seq = printf("\<Esc>]10;rgb:%02x00/%02x00/%02x00\x07", red, green, blue)
|
||||||
|
call feedkeys(seq, 'Lx!')
|
||||||
|
call assert_equal(seq, v:termrfgresp)
|
||||||
|
|
||||||
|
" response to t_RF, 2 digits
|
||||||
|
let red = 0x78
|
||||||
|
let green = 0x9a
|
||||||
|
let blue = 0xbc
|
||||||
|
let seq = printf("\<Esc>]10;rgb:%02x/%02x/%02x\x07", red, green, blue)
|
||||||
|
call feedkeys(seq, 'Lx!')
|
||||||
|
call assert_equal(seq, v:termrfgresp)
|
||||||
|
|
||||||
|
" response to t_RB, 4 digits
|
||||||
|
let red = 0x21
|
||||||
|
let green = 0x43
|
||||||
|
let blue = 0x65
|
||||||
|
let seq = printf("\<Esc>]11;rgb:%02x00/%02x00/%02x00\x07", red, green, blue)
|
||||||
|
call feedkeys(seq, 'Lx!')
|
||||||
|
call assert_equal(seq, v:termrbgresp)
|
||||||
|
|
||||||
|
" response to t_RB, 2 digits
|
||||||
|
let red = 0x87
|
||||||
|
let green = 0xa9
|
||||||
|
let blue = 0xcb
|
||||||
|
let seq = printf("\<Esc>]11;rgb:%02x/%02x/%02x\x07", red, green, blue)
|
||||||
|
call feedkeys(seq, 'Lx!')
|
||||||
|
call assert_equal(seq, v:termrbgresp)
|
||||||
|
|
||||||
|
set t_RF= t_RB=
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" This only checks if the sequence is recognized.
|
||||||
|
" This must be last, because it has side effects to xterm properties.
|
||||||
|
" TODO: check that the values were parsed properly
|
||||||
|
func Test_xx_term_style_response()
|
||||||
|
" Termresponse is only parsed when t_RV is not empty.
|
||||||
|
set t_RV=x
|
||||||
|
|
||||||
|
" send the termresponse to trigger requesting the XT codes
|
||||||
|
let seq = "\<Esc>[>41;337;0c"
|
||||||
|
call feedkeys(seq, 'Lx!')
|
||||||
|
call assert_equal(seq, v:termresponse)
|
||||||
|
|
||||||
|
let seq = "\<Esc>P1$r2 q\<Esc>\\"
|
||||||
|
call feedkeys(seq, 'Lx!')
|
||||||
|
call assert_equal(seq, v:termstyleresp)
|
||||||
|
|
||||||
|
set t_RV=
|
||||||
|
endfunc
|
||||||
|
@@ -767,6 +767,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 */
|
||||||
|
/**/
|
||||||
|
1469,
|
||||||
/**/
|
/**/
|
||||||
1468,
|
1468,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user