To: vim_dev@googlegroups.com Subject: Patch 8.2.0803 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0803 Problem: Libvterm code lags behind the upstream version. Solution: Include revisions 764 - 767 Files: src/Makefile, src/libvterm/src/parser.c, src/libvterm/src/vterm_internal.h, src/libvterm/t/02parser.test, src/libvterm/t/run-test.pl, src/libvterm/find-wide-chars.pl, src/libvterm/src/fullwidth.inc *** ../vim-8.2.0802/src/Makefile 2020-05-17 20:52:40.733955160 +0200 --- src/Makefile 2020-05-20 19:23:50.209290273 +0200 *************** *** 3562,3568 **** 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) $(CCCTERM) -o $@ libvterm/src/unicode.c objects/vterm_vterm.o: libvterm/src/vterm.c $(TERM_DEPS) --- 3562,3568 ---- 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) libvterm/src/fullwidth.inc $(CCCTERM) -o $@ libvterm/src/unicode.c objects/vterm_vterm.o: libvterm/src/vterm.c $(TERM_DEPS) *** ../vim-8.2.0802/src/libvterm/src/parser.c 2020-05-19 21:19:34.887367044 +0200 --- src/libvterm/src/parser.c 2020-05-20 19:18:37.738176853 +0200 *************** *** 119,131 **** #define ENTER_STATE(st) do { vt->parser.state = st; string_start = NULL; } while(0) #define ENTER_NORMAL_STATE() ENTER_STATE(NORMAL) 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) { string_fragment(vt, string_start, bytes + pos - string_start, FALSE); string_start = bytes + pos + 1; } --- 119,133 ---- #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(IS_STRING_STATE()) { string_fragment(vt, string_start, bytes + pos - string_start, FALSE); string_start = bytes + pos + 1; } *************** *** 138,150 **** } else if(c == 0x1b) { // ESC vt->parser.intermedlen = 0; ! if(vt->parser.state < OSC) 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) { // fallthrough } else if(c < 0x20) { // other C0 --- 140,152 ---- } else if(c == 0x1b) { // ESC vt->parser.intermedlen = 0; ! 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 ! IS_STRING_STATE()) { // fallthrough } else if(c < 0x20) { // other C0 *************** *** 155,164 **** 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) string_fragment(vt, string_start, bytes + pos - string_start, FALSE); do_control(vt, c); ! if(vt->parser.state >= OSC) string_start = bytes + pos + 1; continue; } --- 157,166 ---- if(pos + 2 < len && bytes[pos + 1] == 0x20 && bytes[pos + 2] == 0x08) vt->in_backspace = 2; // Trigger when count down to 1 } ! if(IS_STRING_STATE()) string_fragment(vt, string_start, bytes + pos - string_start, FALSE); do_control(vt, c); ! if(IS_STRING_STATE()) string_start = bytes + pos + 1; continue; } *************** *** 171,177 **** // Always accept ESC \ == ST even in string mode if(!vt->parser.intermedlen && c >= 0x40 && c < 0x60 && ! ((vt->parser.state < OSC || c == 0x5c))) { c += 0x40; c1_allowed = TRUE; string_len -= 1; --- 173,179 ---- // Always accept ESC \ == ST even in string mode if(!vt->parser.intermedlen && c >= 0x40 && c < 0x60 && ! ((!IS_STRING_STATE() || c == 0x5c))) { c += 0x40; c1_allowed = TRUE; string_len -= 1; *************** *** 260,265 **** --- 262,268 ---- /* else fallthrough */ string_start = bytes + pos; + string_len = 0; vt->parser.state = OSC; goto string_state; *************** *** 312,317 **** --- 315,321 ---- 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: *** ../vim-8.2.0802/src/libvterm/src/vterm_internal.h 2020-05-20 18:41:37.157258608 +0200 --- src/libvterm/src/vterm_internal.h 2020-05-20 19:19:50.849976876 +0200 *************** *** 187,195 **** CSI_LEADER, CSI_ARGS, CSI_INTERMED, - OSC_COMMAND, DCS_COMMAND, ! // below here are the "string states" OSC, DCS, } state; --- 187,195 ---- CSI_LEADER, CSI_ARGS, CSI_INTERMED, DCS_COMMAND, ! /* below here are the "string states" */ ! OSC_COMMAND, OSC, DCS, } state; *** ../vim-8.2.0802/src/libvterm/t/02parser.test 2020-05-19 21:19:34.891367031 +0200 --- src/libvterm/t/02parser.test 2020-05-20 19:15:32.774654698 +0200 *************** *** 150,155 **** --- 150,163 ---- 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" *** ../vim-8.2.0802/src/libvterm/t/run-test.pl 2020-05-19 21:19:34.887367044 +0200 --- src/libvterm/t/run-test.pl 2020-05-20 19:15:32.774654698 +0200 *************** *** 112,118 **** $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"; --- 112,118 ---- $initial //= ""; $initial .= ";" if $initial =~ m/\d+/; ! $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"; *** ../vim-8.2.0802/src/libvterm/find-wide-chars.pl 2020-05-17 14:59:24.063410405 +0200 --- src/libvterm/find-wide-chars.pl 2020-05-20 19:20:44.997825523 +0200 *************** *** 3,18 **** 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"; } my ( $start, $end ); --- 3,14 ---- use strict; use warnings; STDOUT->autoflush(1); sub iswide { my ( $cp ) = @_; ! return chr($cp) =~ m/\p{East_Asian_Width=Wide}|\p{East_Asian_Width=Fullwidth}/; } my ( $start, $end ); *** ../vim-8.2.0802/src/libvterm/src/fullwidth.inc 2020-05-17 14:59:24.063410405 +0200 --- src/libvterm/src/fullwidth.inc 2020-05-20 19:22:37.777502437 +0200 *************** *** 40,53 **** { 0x3000, 0x303e }, { 0x3041, 0x3096 }, { 0x3099, 0x30ff }, ! { 0x3105, 0x312d }, { 0x3131, 0x318e }, { 0x3190, 0x31ba }, { 0x31c0, 0x31e3 }, { 0x31f0, 0x321e }, { 0x3220, 0x3247 }, ! { 0x3250, 0x32fe }, ! { 0x3300, 0x4dbf }, { 0x4e00, 0xa48c }, { 0xa490, 0xa4c6 }, { 0xa960, 0xa97c }, --- 40,52 ---- { 0x3000, 0x303e }, { 0x3041, 0x3096 }, { 0x3099, 0x30ff }, ! { 0x3105, 0x312f }, { 0x3131, 0x318e }, { 0x3190, 0x31ba }, { 0x31c0, 0x31e3 }, { 0x31f0, 0x321e }, { 0x3220, 0x3247 }, ! { 0x3250, 0x4dbf }, { 0x4e00, 0xa48c }, { 0xa490, 0xa4c6 }, { 0xa960, 0xa97c }, *************** *** 59,68 **** { 0xfe68, 0xfe6b }, { 0xff01, 0xff60 }, { 0xffe0, 0xffe6 }, ! { 0x16fe0, 0x16fe0 }, ! { 0x17000, 0x187ec }, { 0x18800, 0x18af2 }, ! { 0x1b000, 0x1b001 }, { 0x1f004, 0x1f004 }, { 0x1f0cf, 0x1f0cf }, { 0x1f18e, 0x1f18e }, --- 58,70 ---- { 0xfe68, 0xfe6b }, { 0xff01, 0xff60 }, { 0xffe0, 0xffe6 }, ! { 0x16fe0, 0x16fe3 }, ! { 0x17000, 0x187f7 }, { 0x18800, 0x18af2 }, ! { 0x1b000, 0x1b11e }, ! { 0x1b150, 0x1b152 }, ! { 0x1b164, 0x1b167 }, ! { 0x1b170, 0x1b2fb }, { 0x1f004, 0x1f004 }, { 0x1f0cf, 0x1f0cf }, { 0x1f18e, 0x1f18e }, *************** *** 71,76 **** --- 73,79 ---- { 0x1f210, 0x1f23b }, { 0x1f240, 0x1f248 }, { 0x1f250, 0x1f251 }, + { 0x1f260, 0x1f265 }, { 0x1f300, 0x1f320 }, { 0x1f32d, 0x1f335 }, { 0x1f337, 0x1f37c }, *************** *** 92,104 **** { 0x1f680, 0x1f6c5 }, { 0x1f6cc, 0x1f6cc }, { 0x1f6d0, 0x1f6d2 }, { 0x1f6eb, 0x1f6ec }, ! { 0x1f6f4, 0x1f6f6 }, ! { 0x1f910, 0x1f91e }, ! { 0x1f920, 0x1f927 }, ! { 0x1f930, 0x1f930 }, ! { 0x1f933, 0x1f93e }, ! { 0x1f940, 0x1f94b }, ! { 0x1f950, 0x1f95e }, ! { 0x1f980, 0x1f991 }, ! { 0x1f9c0, 0x1f9c0 }, --- 95,111 ---- { 0x1f680, 0x1f6c5 }, { 0x1f6cc, 0x1f6cc }, { 0x1f6d0, 0x1f6d2 }, + { 0x1f6d5, 0x1f6d5 }, { 0x1f6eb, 0x1f6ec }, ! { 0x1f6f4, 0x1f6fa }, ! { 0x1f7e0, 0x1f7eb }, ! { 0x1f90d, 0x1f971 }, ! { 0x1f973, 0x1f976 }, ! { 0x1f97a, 0x1f9a2 }, ! { 0x1f9a5, 0x1f9aa }, ! { 0x1f9ae, 0x1f9ca }, ! { 0x1f9cd, 0x1f9ff }, ! { 0x1fa70, 0x1fa73 }, ! { 0x1fa78, 0x1fa7a }, ! { 0x1fa80, 0x1fa82 }, ! { 0x1fa90, 0x1fa95 }, *** ../vim-8.2.0802/src/version.c 2020-05-20 18:41:37.161258592 +0200 --- src/version.c 2020-05-20 19:25:31.452988711 +0200 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 803, /**/ -- hundred-and-one symptoms of being an internet addict: 145. You e-mail your boss, informing him you'll be late. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///