1
0
forked from aniani/vim

patch 8.2.0798: libvterm code lags behind the upstream version

Problem:    Libvterm code lags behind the upstream version.
Solution:   Include revisions 755 - 758.
This commit is contained in:
Bram Moolenaar
2020-05-19 21:20:04 +02:00
parent 904e48a22b
commit be593bf135
14 changed files with 396 additions and 312 deletions

View File

@@ -132,15 +132,23 @@ PUSH "\e[12\n;3X"
!OSC BEL
PUSH "\e]1;Hello\x07"
osc "1;Hello"
osc [1 "Hello"]
!OSC ST (7bit)
PUSH "\e]1;Hello\e\\"
osc "1;Hello"
osc [1 "Hello"]
!OSC ST (8bit)
PUSH "\x{9d}1;Hello\x9c"
osc "1;Hello"
osc [1 "Hello"]
!OSC in parts
PUSH "\e]52;abc"
osc [52 "abc"
PUSH "def"
osc "def"
PUSH "ghi\e\\"
osc "ghi"]
!Escape cancels OSC, starts Escape
PUSH "\e]Something\e9"
@@ -152,20 +160,21 @@ PUSH "\e]12\x{18}AB"
!C0 in OSC interrupts and continues
PUSH "\e]2;\nBye\x07"
osc [2 ""
control 10
osc "2;Bye"
osc "Bye"]
!DCS BEL
PUSH "\ePHello\x07"
dcs "Hello"
dcs ["Hello"]
!DCS ST (7bit)
PUSH "\ePHello\e\\"
dcs "Hello"
dcs ["Hello"]
!DCS ST (8bit)
PUSH "\x{90}Hello\x9c"
dcs "Hello"
dcs ["Hello"]
!Escape cancels DCS, starts Escape
PUSH "\ePSomething\e9"
@@ -177,8 +186,9 @@ PUSH "\eP12\x{18}AB"
!C0 in OSC interrupts and continues
PUSH "\ePBy\ne\x07"
dcs ["By"
control 10
dcs "Bye"
dcs "e"]
!NUL ignored
PUSH "\x{00}"

View File

@@ -33,4 +33,10 @@ PUSH "\e[3 q"
!Title
PUSH "\e]2;Here is my title\a"
settermprop 4 "Here is my title"
settermprop 4 ["Here is my title"]
!Title split write
PUSH "\e]2;Here is"
settermprop 4 ["Here is"
PUSH " another title\a"
settermprop 4 " another title"]

View File

@@ -12,8 +12,8 @@ PUSH "\e[?15;2z"
!Unrecognised OSC
PUSH "\e]27;Something\e\\"
osc "27;Something"
osc [27 "Something"]
!Unrecognised DCS
PUSH "\ePz123\e\\"
dcs "z123"
dcs ["z123"]

View File

@@ -14,4 +14,4 @@ PUSH "\e[?25l"
!Title
PUSH "\e]2;Here is my title\a"
settermprop 4 "Here is my title"
settermprop 4 ["Here is my title"]

View File

@@ -153,21 +153,44 @@ static int parser_csi(const char *leader, const long args[], int argcount, const
return 1;
}
static int parser_osc(const char *command, size_t cmdlen, void *user UNUSED)
static int parser_osc(int command, VTermStringFragment frag, void *user UNUSED)
{
printf("osc ");
printhex(command, cmdlen);
if(frag.initial) {
if(command == -1)
printf("[");
else
printf("[%d;", command);
}
printhex(frag.str, frag.len);
if(frag.final)
printf("]");
printf("\n");
return 1;
}
static int parser_dcs(const char *command, size_t cmdlen, void *user UNUSED)
static int parser_dcs(const char *command, size_t commandlen, VTermStringFragment frag, void *user UNUSED)
{
printf("dcs ");
printhex(command, cmdlen);
if(frag.initial) {
size_t i;
printf("[");
for(i = 0; i < commandlen; i++)
printf("%02x", command[i]);
}
printhex(frag.str, frag.len);
if(frag.final)
printf("]");
printf("\n");
return 1;
@@ -239,7 +262,8 @@ static int settermprop(VTermProp prop, VTermValue *val, void *user UNUSED)
printf("settermprop %d %d\n", prop, val->number);
return 1;
case VTERM_VALUETYPE_STRING:
printf("settermprop %d \"%s\"\n", prop, val->string);
printf("settermprop %d %s\"%.*s\"%s\n", prop,
val->string.initial ? "[" : "", val->string.len, val->string.str, val->string.final ? "]" : "");
return 1;
case VTERM_VALUETYPE_COLOR:
printf("settermprop %d rgb(%d,%d,%d)\n", prop, val->color.red, val->color.green, val->color.blue);
@@ -262,7 +286,7 @@ static int state_putglyph(VTermGlyphInfo *info, VTermPos pos, void *user UNUSED)
return 1;
printf("putglyph ");
for(i = 0; info->chars[i]; i++)
for(i = 0; i < VTERM_MAX_CHARS_PER_CELL && info->chars[i]; i++)
printf(i ? ",%x" : "%x", info->chars[i]);
printf(" %d %d,%d", info->width, pos.row, pos.col);
if(info->protected_cell)

View File

@@ -11,7 +11,8 @@ my $VALGRIND = 0;
my $EXECUTABLE = "t/.libs/harness";
GetOptions(
'valgrind|v+' => \$VALGRIND,
'executable|e=s' => \$EXECUTABLE
'executable|e=s' => \$EXECUTABLE,
'fail-early|F' => \(my $FAIL_EARLY),
) or exit 1;
my ( $hin, $hout, $hpid );
@@ -65,6 +66,7 @@ sub do_onetest
}
$exitcode = 1 if $fail_printed;
exit $exitcode if $exitcode and $FAIL_EARLY;
}
sub do_line
@@ -105,8 +107,15 @@ sub do_line
elsif( $line =~ m/^csi (\S+) (.*)$/ ) {
$line = sprintf "csi %02x %s", eval($1), $2; # TODO
}
elsif( $line =~ m/^(escape|osc|dcs) (.*)$/ ) {
$line = "$1 " . join "", map sprintf("%02x", $_), unpack "C*", eval($2);
elsif( $line =~ m/^(osc) (\[\d+)? *(.*?)(\]?)$/ ) {
my ( $cmd, $initial, $data, $final ) = ( $1, $2, $3, $4 );
$initial //= "";
$initial .= ";" if $initial =~ m/\d+/;
$line = "$cmd $initial" . join( "", map sprintf("%02x", $_), unpack "C*", eval($data) ) . "$final";
}
elsif( $line =~ m/^(escape|dcs) (\[?)(.*?)(\]?)$/ ) {
$line = "$1 $2" . join( "", map sprintf("%02x", $_), unpack "C*", eval($3) ) . "$4";
}
elsif( $line =~ m/^putglyph (\S+) (.*)$/ ) {
$line = "putglyph " . join( ",", map sprintf("%x", $_), eval($1) ) . " $2";
@@ -139,6 +148,7 @@ sub do_line
"# Expected: $want\n" .
"# Actual: $response\n";
$exitcode = 1;
exit $exitcode if $exitcode and $FAIL_EARLY;
}
}
# Assertions start with '?'
@@ -162,6 +172,7 @@ sub do_line
"# Expected: $expectation\n" .
"# Actual: $response\n";
$exitcode = 1;
exit $exitcode if $exitcode and $FAIL_EARLY;
}
}
# Test controls start with '$'