1
0
forked from aniani/vim

patch 8.2.0803: libvterm code lags behind the upstream version

Problem:    Libvterm code lags behind the upstream version.
Solution:   Include revisions 764 - 767
This commit is contained in:
Bram Moolenaar 2020-05-20 19:30:19 +02:00
parent d863728913
commit 83a52533b2
8 changed files with 47 additions and 30 deletions

View File

@ -3562,7 +3562,7 @@ objects/vterm_screen.o: libvterm/src/screen.c $(TERM_DEPS)
objects/vterm_state.o: libvterm/src/state.c $(TERM_DEPS)
$(CCCTERM) -o $@ libvterm/src/state.c
objects/vterm_unicode.o: libvterm/src/unicode.c $(TERM_DEPS)
objects/vterm_unicode.o: libvterm/src/unicode.c $(TERM_DEPS) libvterm/src/fullwidth.inc
$(CCCTERM) -o $@ libvterm/src/unicode.c
objects/vterm_vterm.o: libvterm/src/vterm.c $(TERM_DEPS)

View File

@ -3,16 +3,12 @@
use strict;
use warnings;
use Unicode::UCD qw( charprop );
STDOUT->autoflush(1);
sub iswide
{
my ( $cp ) = @_;
my $width = charprop( $cp, "East_Asian_Width" ) or return;
return $width eq "Wide" || $width eq "Fullwidth";
return chr($cp) =~ m/\p{East_Asian_Width=Wide}|\p{East_Asian_Width=Fullwidth}/;
}
my ( $start, $end );

View File

@ -40,14 +40,13 @@
{ 0x3000, 0x303e },
{ 0x3041, 0x3096 },
{ 0x3099, 0x30ff },
{ 0x3105, 0x312d },
{ 0x3105, 0x312f },
{ 0x3131, 0x318e },
{ 0x3190, 0x31ba },
{ 0x31c0, 0x31e3 },
{ 0x31f0, 0x321e },
{ 0x3220, 0x3247 },
{ 0x3250, 0x32fe },
{ 0x3300, 0x4dbf },
{ 0x3250, 0x4dbf },
{ 0x4e00, 0xa48c },
{ 0xa490, 0xa4c6 },
{ 0xa960, 0xa97c },
@ -59,10 +58,13 @@
{ 0xfe68, 0xfe6b },
{ 0xff01, 0xff60 },
{ 0xffe0, 0xffe6 },
{ 0x16fe0, 0x16fe0 },
{ 0x17000, 0x187ec },
{ 0x16fe0, 0x16fe3 },
{ 0x17000, 0x187f7 },
{ 0x18800, 0x18af2 },
{ 0x1b000, 0x1b001 },
{ 0x1b000, 0x1b11e },
{ 0x1b150, 0x1b152 },
{ 0x1b164, 0x1b167 },
{ 0x1b170, 0x1b2fb },
{ 0x1f004, 0x1f004 },
{ 0x1f0cf, 0x1f0cf },
{ 0x1f18e, 0x1f18e },
@ -71,6 +73,7 @@
{ 0x1f210, 0x1f23b },
{ 0x1f240, 0x1f248 },
{ 0x1f250, 0x1f251 },
{ 0x1f260, 0x1f265 },
{ 0x1f300, 0x1f320 },
{ 0x1f32d, 0x1f335 },
{ 0x1f337, 0x1f37c },
@ -92,13 +95,17 @@
{ 0x1f680, 0x1f6c5 },
{ 0x1f6cc, 0x1f6cc },
{ 0x1f6d0, 0x1f6d2 },
{ 0x1f6d5, 0x1f6d5 },
{ 0x1f6eb, 0x1f6ec },
{ 0x1f6f4, 0x1f6f6 },
{ 0x1f910, 0x1f91e },
{ 0x1f920, 0x1f927 },
{ 0x1f930, 0x1f930 },
{ 0x1f933, 0x1f93e },
{ 0x1f940, 0x1f94b },
{ 0x1f950, 0x1f95e },
{ 0x1f980, 0x1f991 },
{ 0x1f9c0, 0x1f9c0 },
{ 0x1f6f4, 0x1f6fa },
{ 0x1f7e0, 0x1f7eb },
{ 0x1f90d, 0x1f971 },
{ 0x1f973, 0x1f976 },
{ 0x1f97a, 0x1f9a2 },
{ 0x1f9a5, 0x1f9aa },
{ 0x1f9ae, 0x1f9ca },
{ 0x1f9cd, 0x1f9ff },
{ 0x1fa70, 0x1fa73 },
{ 0x1fa78, 0x1fa7a },
{ 0x1fa80, 0x1fa82 },
{ 0x1fa90, 0x1fa95 },

View File

@ -119,13 +119,15 @@ size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len)
#define ENTER_STATE(st) do { vt->parser.state = st; string_start = NULL; } while(0)
#define ENTER_NORMAL_STATE() ENTER_STATE(NORMAL)
#define IS_STRING_STATE() (vt->parser.state >= OSC_COMMAND)
for( ; pos < len; pos++) {
unsigned char c = bytes[pos];
int c1_allowed = !vt->mode.utf8;
size_t string_len;
if(c == 0x00 || c == 0x7f) { // NUL, DEL
if(vt->parser.state >= OSC) {
if(IS_STRING_STATE()) {
string_fragment(vt, string_start, bytes + pos - string_start, FALSE);
string_start = bytes + pos + 1;
}
@ -138,13 +140,13 @@ size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len)
}
else if(c == 0x1b) { // ESC
vt->parser.intermedlen = 0;
if(vt->parser.state < OSC)
if(!IS_STRING_STATE())
vt->parser.state = NORMAL;
vt->parser.in_esc = TRUE;
continue;
}
else if(c == 0x07 && // BEL, can stand for ST in OSC or DCS state
vt->parser.state >= OSC) {
IS_STRING_STATE()) {
// fallthrough
}
else if(c < 0x20) { // other C0
@ -155,10 +157,10 @@ size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len)
if(pos + 2 < len && bytes[pos + 1] == 0x20 && bytes[pos + 2] == 0x08)
vt->in_backspace = 2; // Trigger when count down to 1
}
if(vt->parser.state >= OSC)
if(IS_STRING_STATE())
string_fragment(vt, string_start, bytes + pos - string_start, FALSE);
do_control(vt, c);
if(vt->parser.state >= OSC)
if(IS_STRING_STATE())
string_start = bytes + pos + 1;
continue;
}
@ -171,7 +173,7 @@ size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len)
// Always accept ESC \ == ST even in string mode
if(!vt->parser.intermedlen &&
c >= 0x40 && c < 0x60 &&
((vt->parser.state < OSC || c == 0x5c))) {
((!IS_STRING_STATE() || c == 0x5c))) {
c += 0x40;
c1_allowed = TRUE;
string_len -= 1;
@ -260,6 +262,7 @@ size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len)
/* else fallthrough */
string_start = bytes + pos;
string_len = 0;
vt->parser.state = OSC;
goto string_state;
@ -312,6 +315,7 @@ string_state:
case 0x9d: // OSC
vt->parser.v.osc.command = -1;
vt->parser.string_initial = TRUE;
string_start = bytes + pos + 1;
ENTER_STATE(OSC_COMMAND);
break;
default:

View File

@ -187,9 +187,9 @@ struct VTerm
CSI_LEADER,
CSI_ARGS,
CSI_INTERMED,
OSC_COMMAND,
DCS_COMMAND,
// below here are the "string states"
/* below here are the "string states" */
OSC_COMMAND,
OSC,
DCS,
} state;

View File

@ -150,6 +150,14 @@ PUSH "def"
PUSH "ghi\e\\"
osc "ghi"]
!OSC BEL without semicolon
PUSH "\e]1234\x07"
osc [1234 ]
!OSC ST without semicolon
PUSH "\e]1234\e\\"
osc [1234 ]
!Escape cancels OSC, starts Escape
PUSH "\e]Something\e9"
escape "9"

View File

@ -112,7 +112,7 @@ sub do_line
$initial //= "";
$initial .= ";" if $initial =~ m/\d+/;
$line = "$cmd $initial" . join( "", map sprintf("%02x", $_), unpack "C*", eval($data) ) . "$final";
$line = "$cmd $initial" . join( "", map sprintf("%02x", $_), unpack "C*", length $data ? eval($data) : "" ) . "$final";
}
elsif( $line =~ m/^(escape|dcs) (\[?)(.*?)(\]?)$/ ) {
$line = "$1 $2" . join( "", map sprintf("%02x", $_), unpack "C*", eval($3) ) . "$4";

View File

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