forked from aniani/vim
patch 8.2.0795: libvterm code lags behind the upstream version
Problem: Libvterm code lags behind the upstream version. Solution: Include revisions 748 - 754.
This commit is contained in:
28
src/libvterm/t/32state_flow.test
Normal file
28
src/libvterm/t/32state_flow.test
Normal file
@@ -0,0 +1,28 @@
|
||||
INIT
|
||||
WANTSTATE
|
||||
|
||||
# Many of these test cases inspired by
|
||||
# https://blueprints.launchpad.net/libvterm/+spec/reflow-cases
|
||||
|
||||
!Spillover text marks continuation on second line
|
||||
RESET
|
||||
PUSH "A"x100
|
||||
PUSH "\r\n"
|
||||
?lineinfo 0 =
|
||||
?lineinfo 1 = cont
|
||||
|
||||
!CRLF in column 80 does not mark continuation
|
||||
RESET
|
||||
PUSH "B"x80
|
||||
PUSH "\r\n"
|
||||
PUSH "B"x20
|
||||
PUSH "\r\n"
|
||||
?lineinfo 0 =
|
||||
?lineinfo 1 =
|
||||
|
||||
!EL cancels continuation of following line
|
||||
RESET
|
||||
PUSH "D"x100
|
||||
?lineinfo 1 = cont
|
||||
PUSH "\eM\e[79G\e[K"
|
||||
?lineinfo 1 =
|
||||
@@ -1,12 +1,12 @@
|
||||
INIT
|
||||
WANTSCREEN c
|
||||
WANTSCREEN ac
|
||||
|
||||
!Get
|
||||
RESET
|
||||
PUSH "ABC"
|
||||
movecursor 0,3
|
||||
?screen_chars 0,0,1,3 = 0x41,0x42,0x43
|
||||
?screen_chars 0,0,1,80 = 0x41,0x42,0x43
|
||||
?screen_chars 0,0,1,3 = "ABC"
|
||||
?screen_chars 0,0,1,80 = "ABC"
|
||||
?screen_text 0,0,1,3 = 0x41,0x42,0x43
|
||||
?screen_text 0,0,1,80 = 0x41,0x42,0x43
|
||||
?screen_cell 0,0 = {0x41} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0)
|
||||
@@ -18,11 +18,11 @@ PUSH "ABC"
|
||||
?screen_eol 0,3 = 1
|
||||
PUSH "\e[H"
|
||||
movecursor 0,0
|
||||
?screen_chars 0,0,1,80 = 0x41,0x42,0x43
|
||||
?screen_chars 0,0,1,80 = "ABC"
|
||||
?screen_text 0,0,1,80 = 0x41,0x42,0x43
|
||||
PUSH "E"
|
||||
movecursor 0,1
|
||||
?screen_chars 0,0,1,80 = 0x45,0x42,0x43
|
||||
?screen_chars 0,0,1,80 = "EBC"
|
||||
?screen_text 0,0,1,80 = 0x45,0x42,0x43
|
||||
|
||||
WANTSCREEN -c
|
||||
@@ -37,33 +37,33 @@ PUSH "ABCDE\e[H\e[K"
|
||||
RESET
|
||||
PUSH "ABC\e[H\e[@"
|
||||
PUSH "1"
|
||||
?screen_chars 0,0,1,80 = 0x31,0x41,0x42,0x43
|
||||
?screen_chars 0,0,1,80 = "1ABC"
|
||||
|
||||
RESET
|
||||
PUSH "ABC\e[H\e[P"
|
||||
?screen_chars 0,0,1,1 = 0x42
|
||||
?screen_chars 0,1,1,2 = 0x43
|
||||
?screen_chars 0,0,1,80 = 0x42,0x43
|
||||
?screen_chars 0,0,1,1 = "B"
|
||||
?screen_chars 0,1,1,2 = "C"
|
||||
?screen_chars 0,0,1,80 = "BC"
|
||||
|
||||
!Space padding
|
||||
RESET
|
||||
PUSH "Hello\e[CWorld"
|
||||
?screen_chars 0,0,1,80 = 0x48,0x65,0x6c,0x6c,0x6f,0x20,0x57,0x6f,0x72,0x6c,0x64
|
||||
?screen_chars 0,0,1,80 = "Hello World"
|
||||
?screen_text 0,0,1,80 = 0x48,0x65,0x6c,0x6c,0x6f,0x20,0x57,0x6f,0x72,0x6c,0x64
|
||||
|
||||
!Linefeed padding
|
||||
RESET
|
||||
PUSH "Hello\r\nWorld"
|
||||
?screen_chars 0,0,2,80 = 0x48,0x65,0x6c,0x6c,0x6f,0x0a,0x57,0x6f,0x72,0x6c,0x64
|
||||
?screen_chars 0,0,2,80 = "Hello\nWorld"
|
||||
?screen_text 0,0,2,80 = 0x48,0x65,0x6c,0x6c,0x6f,0x0a,0x57,0x6f,0x72,0x6c,0x64
|
||||
|
||||
!Altscreen
|
||||
RESET
|
||||
PUSH "P"
|
||||
?screen_chars 0,0,1,80 = 0x50
|
||||
?screen_chars 0,0,1,80 = "P"
|
||||
PUSH "\e[?1049h"
|
||||
?screen_chars 0,0,1,80 =
|
||||
PUSH "\e[2K\e[HA"
|
||||
?screen_chars 0,0,1,80 = 0x41
|
||||
?screen_chars 0,0,1,80 = "A"
|
||||
PUSH "\e[?1049l"
|
||||
?screen_chars 0,0,1,80 = 0x50
|
||||
?screen_chars 0,0,1,80 = "P"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
INIT
|
||||
WANTSCREEN Db
|
||||
WANTSCREEN aDb
|
||||
|
||||
!Putglyph
|
||||
RESET
|
||||
@@ -152,4 +152,4 @@ PUSH "\e[25H\r\nABCDE\b\b\b\e[2P\r\n"
|
||||
DAMAGEFLUSH
|
||||
moverect 1..25,0..80 -> 0..24,0..80
|
||||
damage 24..25,0..80
|
||||
?screen_chars 23,0,24,5 = 0x41,0x42,0x45
|
||||
?screen_chars 23,0,24,5 = "ABE"
|
||||
|
||||
@@ -6,42 +6,42 @@ WANTSCREEN
|
||||
RESET
|
||||
RESIZE 25,80
|
||||
PUSH "AB\r\nCD"
|
||||
?screen_chars 0,0,1,80 = 0x41,0x42
|
||||
?screen_chars 1,0,2,80 = 0x43,0x44
|
||||
?screen_chars 0,0,1,80 = "AB"
|
||||
?screen_chars 1,0,2,80 = "CD"
|
||||
RESIZE 25,100
|
||||
?screen_chars 0,0,1,100 = 0x41,0x42
|
||||
?screen_chars 1,0,2,100 = 0x43,0x44
|
||||
?screen_chars 0,0,1,100 = "AB"
|
||||
?screen_chars 1,0,2,100 = "CD"
|
||||
|
||||
!Resize wider allows print in new area
|
||||
RESET
|
||||
RESIZE 25,80
|
||||
PUSH "AB\e[79GCD"
|
||||
?screen_chars 0,0,1,2 = 0x41,0x42
|
||||
?screen_chars 0,78,1,80 = 0x43,0x44
|
||||
?screen_chars 0,0,1,2 = "AB"
|
||||
?screen_chars 0,78,1,80 = "CD"
|
||||
RESIZE 25,100
|
||||
?screen_chars 0,0,1,2 = 0x41,0x42
|
||||
?screen_chars 0,78,1,80 = 0x43,0x44
|
||||
?screen_chars 0,0,1,2 = "AB"
|
||||
?screen_chars 0,78,1,80 = "CD"
|
||||
PUSH "E"
|
||||
?screen_chars 0,78,1,81 = 0x43,0x44,0x45
|
||||
?screen_chars 0,78,1,81 = "CDE"
|
||||
|
||||
!Resize shorter with blanks just truncates
|
||||
RESET
|
||||
RESIZE 25,80
|
||||
PUSH "Top\e[10HLine 10"
|
||||
?screen_chars 0,0,1,80 = 0x54,0x6f,0x70
|
||||
?screen_chars 9,0,10,80 = 0x4c,0x69,0x6e,0x65,0x20,0x31,0x30
|
||||
?screen_chars 0,0,1,80 = "Top"
|
||||
?screen_chars 9,0,10,80 = "Line 10"
|
||||
?cursor = 9,7
|
||||
RESIZE 20,80
|
||||
?screen_chars 0,0,1,80 = 0x54,0x6f,0x70
|
||||
?screen_chars 9,0,10,80 = 0x4c,0x69,0x6e,0x65,0x20,0x31,0x30
|
||||
?screen_chars 0,0,1,80 = "Top"
|
||||
?screen_chars 9,0,10,80 = "Line 10"
|
||||
?cursor = 9,7
|
||||
|
||||
!Resize shorter with content must scroll
|
||||
RESET
|
||||
RESIZE 25,80
|
||||
PUSH "Top\e[25HLine 25\e[15H"
|
||||
?screen_chars 0,0,1,80 = 0x54,0x6f,0x70
|
||||
?screen_chars 24,0,25,80 = 0x4c,0x69,0x6e,0x65,0x20,0x32,0x35
|
||||
?screen_chars 0,0,1,80 = "Top"
|
||||
?screen_chars 24,0,25,80 = "Line 25"
|
||||
?cursor = 14,0
|
||||
WANTSCREEN b
|
||||
RESIZE 20,80
|
||||
@@ -51,7 +51,7 @@ RESIZE 20,80
|
||||
sb_pushline 80 =
|
||||
sb_pushline 80 =
|
||||
?screen_chars 0,0,1,80 =
|
||||
?screen_chars 19,0,20,80 = 0x4c,0x69,0x6e,0x65,0x20,0x32,0x35
|
||||
?screen_chars 19,0,20,80 = "Line 25"
|
||||
?cursor = 9,0
|
||||
|
||||
!Resize shorter does not lose line with cursor
|
||||
@@ -62,11 +62,11 @@ RESIZE 25,80
|
||||
WANTSCREEN b
|
||||
PUSH "\e[24HLine 24\r\nLine 25\r\n"
|
||||
sb_pushline 80 =
|
||||
?screen_chars 23,0,24,10 = 0x4c,0x69,0x6e,0x65,0x20,0x32,0x35
|
||||
?screen_chars 23,0,24,10 = "Line 25"
|
||||
?cursor = 24,0
|
||||
RESIZE 24,80
|
||||
sb_pushline 80 =
|
||||
?screen_chars 22,0,23,10 = 0x4c,0x69,0x6e,0x65,0x20,0x32,0x35
|
||||
?screen_chars 22,0,23,10 = "Line 25"
|
||||
?cursor = 23,0
|
||||
|
||||
!Resize taller attempts to pop scrollback
|
||||
@@ -74,8 +74,8 @@ RESET
|
||||
WANTSCREEN -b
|
||||
RESIZE 25,80
|
||||
PUSH "Line 1\e[25HBottom\e[15H"
|
||||
?screen_chars 0,0,1,80 = 0x4c,0x69,0x6e,0x65,0x20,0x31
|
||||
?screen_chars 24,0,25,80 = 0x42,0x6f,0x74,0x74,0x6f,0x6d
|
||||
?screen_chars 0,0,1,80 = "Line 1"
|
||||
?screen_chars 24,0,25,80 = "Bottom"
|
||||
?cursor = 14,0
|
||||
WANTSCREEN b
|
||||
RESIZE 30,80
|
||||
@@ -84,7 +84,18 @@ RESIZE 30,80
|
||||
sb_popline 80
|
||||
sb_popline 80
|
||||
sb_popline 80
|
||||
?screen_chars 0,0,1,80 = 0x41,0x42,0x43,0x44,0x45
|
||||
?screen_chars 5,0,6,80 = 0x4c,0x69,0x6e,0x65,0x20,0x31
|
||||
?screen_chars 29,0,30,80 = 0x42,0x6f,0x74,0x74,0x6f,0x6d
|
||||
?screen_chars 0,0,1,80 = "ABCDE"
|
||||
?screen_chars 5,0,6,80 = "Line 1"
|
||||
?screen_chars 29,0,30,80 = "Bottom"
|
||||
?cursor = 19,0
|
||||
WANTSCREEN -b
|
||||
|
||||
!Resize can operate on altscreen
|
||||
RESET
|
||||
WANTSCREEN a
|
||||
RESIZE 25,80
|
||||
PUSH "Main screen\e[?1049h\e[HAlt screen"
|
||||
RESIZE 30,80
|
||||
?screen_chars 0,0,1,3 = "Alt"
|
||||
PUSH "\e[?1049l"
|
||||
?screen_chars 0,0,1,3 = "Mai"
|
||||
|
||||
@@ -540,7 +540,6 @@ int main(int argc UNUSED, char **argv UNUSED)
|
||||
int sense = 1;
|
||||
if(!screen)
|
||||
screen = vterm_obtain_screen(vt);
|
||||
vterm_screen_enable_altscreen(screen, 1);
|
||||
vterm_screen_set_callbacks(screen, &screen_cbs, NULL);
|
||||
|
||||
while(line[i] == ' ')
|
||||
@@ -550,6 +549,9 @@ int main(int argc UNUSED, char **argv UNUSED)
|
||||
case '-':
|
||||
sense = 0;
|
||||
break;
|
||||
case 'a':
|
||||
vterm_screen_enable_altscreen(screen, 1);
|
||||
break;
|
||||
case 'd':
|
||||
want_screen_damage = sense;
|
||||
break;
|
||||
@@ -805,6 +807,25 @@ int main(int argc UNUSED, char **argv UNUSED)
|
||||
else
|
||||
printf("?\n");
|
||||
}
|
||||
else if(strstartswith(line, "?lineinfo ")) {
|
||||
char *linep = line + 10;
|
||||
int row;
|
||||
const VTermLineInfo *info;
|
||||
while(linep[0] == ' ')
|
||||
linep++;
|
||||
if(sscanf(linep, "%d", &row) < 1) {
|
||||
printf("! lineinfo unrecognised input\n");
|
||||
goto abort_line;
|
||||
}
|
||||
info = vterm_state_get_lineinfo(state, row);
|
||||
if(info->doublewidth)
|
||||
printf("dwl ");
|
||||
if(info->doubleheight)
|
||||
printf("dhl ");
|
||||
if(info->continuation)
|
||||
printf("cont ");
|
||||
printf("\n");
|
||||
}
|
||||
else if(strstartswith(line, "?screen_chars ")) {
|
||||
char *linep = line + 13;
|
||||
VTermRect rect;
|
||||
|
||||
@@ -28,6 +28,8 @@ my $exitcode = 0;
|
||||
my $command;
|
||||
my @expect;
|
||||
|
||||
my $linenum = 0;
|
||||
|
||||
sub do_onetest
|
||||
{
|
||||
$hin->print( "$command\n" );
|
||||
@@ -41,7 +43,7 @@ sub do_onetest
|
||||
chomp $outline;
|
||||
|
||||
if( !@expect ) {
|
||||
print "# Test failed\n" unless $fail_printed++;
|
||||
print "# line $linenum: Test failed\n" unless $fail_printed++;
|
||||
print "# expected nothing more\n" .
|
||||
"# Actual: $outline\n";
|
||||
next;
|
||||
@@ -51,13 +53,13 @@ sub do_onetest
|
||||
|
||||
next if $expectation eq $outline;
|
||||
|
||||
print "# Test failed\n" unless $fail_printed++;
|
||||
print "# line $linenum: Test failed\n" unless $fail_printed++;
|
||||
print "# Expected: $expectation\n" .
|
||||
"# Actual: $outline\n";
|
||||
}
|
||||
|
||||
if( @expect ) {
|
||||
print "# Test failed\n" unless $fail_printed++;
|
||||
print "# line $linenum: Test failed\n" unless $fail_printed++;
|
||||
print "# Expected: $_\n" .
|
||||
"# didn't happen\n" for @expect;
|
||||
}
|
||||
@@ -133,7 +135,7 @@ sub do_line
|
||||
|
||||
$response = pack "C*", map hex, split m/,/, $response;
|
||||
if( $response ne $want ) {
|
||||
print "# Assert ?screen_row $row failed:\n" .
|
||||
print "# line $linenum: Assert ?screen_row $row failed:\n" .
|
||||
"# Expected: $want\n" .
|
||||
"# Actual: $response\n";
|
||||
$exitcode = 1;
|
||||
@@ -144,14 +146,20 @@ sub do_line
|
||||
do_onetest if defined $command;
|
||||
|
||||
my ( $assertion ) = $1 =~ m/^(.*)\s+=/;
|
||||
my $expectation = $line;
|
||||
|
||||
$hin->print( "\?$assertion\n" );
|
||||
my $response = <$hout>; defined $response or wait, die "Test harness failed - $?\n";
|
||||
chomp $response; $response =~ s/^\s+|\s+$//g;
|
||||
|
||||
if( $response ne $line ) {
|
||||
print "# Assert $assertion failed:\n" .
|
||||
"# Expected: $line\n" .
|
||||
# Some convenience formatting
|
||||
if( $assertion =~ m/^screen_chars/ and $expectation =~ m/^"/ ) {
|
||||
$expectation = join ",", map sprintf("0x%02x", ord $_), split m//, eval($expectation);
|
||||
}
|
||||
|
||||
if( $response ne $expectation ) {
|
||||
print "# line $linenum: Assert $assertion failed:\n" .
|
||||
"# Expected: $expectation\n" .
|
||||
"# Actual: $response\n";
|
||||
$exitcode = 1;
|
||||
}
|
||||
@@ -176,6 +184,7 @@ sub do_line
|
||||
open my $test, "<", $ARGV[0] or die "Cannot open test script $ARGV[0] - $!";
|
||||
|
||||
while( my $line = <$test> ) {
|
||||
$linenum++;
|
||||
$line =~ s/^\s+//;
|
||||
chomp $line;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user