patch 9.0.1684: Update libvterm to rev 839
Problem: libvterm slightly outdated
Solution: Update libvterm from rev 818 to rev 839
Notable fix: libvterm now handles DECSM/DECRM with multiple arguents,
so several ncurses programs (e.g. nnn) can enable mouse properly when
run in Vim's terminal in XTerm.
closes: #12746
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
diff --git a/src/libvterm/t/17state_mouse.test b/src/libvterm/t/17state_mouse.test
index e5ba29b..33b7dc2 100644
--- a/src/libvterm/t/17state_mouse.test
+++ b/src/libvterm/t/17state_mouse.test
@@ -55,6 +55,10 @@
output "\e[M\x60\x36\x2b"
MOUSEBTN d 5 0
output "\e[M\x61\x36\x2b"
+MOUSEBTN d 6 0
+ output "\e[M\x62\x36\x2b"
+MOUSEBTN d 7 0
+ output "\e[M\x63\x36\x2b"
!DECRQM on mouse button mode
PUSH "\e[?1000\$p"
@@ -179,3 +183,9 @@
MOUSEMOVE 0,0 0
MOUSEBTN d 1 0
MOUSEBTN u 1 0
+
+!DECSM can set multiple modes at once
+PUSH "\e[?1002;1006h"
+ settermprop 8 2
+MOUSEBTN d 1 0
+ output "\e[<0;1;1M"
diff --git a/src/libvterm/t/25state_input.test b/src/libvterm/t/25state_input.test
index 4eb4c6a..11013ed 100644
--- a/src/libvterm/t/25state_input.test
+++ b/src/libvterm/t/25state_input.test
@@ -148,7 +148,9 @@
FOCUS OUT
!Focus reporting enabled
+WANTSTATE +p
PUSH "\e[?1004h"
+ settermprop 9 true
FOCUS IN
output "\e[I"
FOCUS OUT
diff --git a/src/libvterm/t/30state_pen.test b/src/libvterm/t/30state_pen.test
index 92cf01d..1a6cd01 100644
--- a/src/libvterm/t/30state_pen.test
+++ b/src/libvterm/t/30state_pen.test
@@ -123,3 +123,11 @@
PUSH "\e[75m"
?pen small = off
?pen baseline = normal
+
+!DECSTR resets pen attributes
+PUSH "\e[1;4m"
+ ?pen bold = on
+ ?pen underline = 1
+PUSH "\e[!p"
+ ?pen bold = off
+ ?pen underline = 0
diff --git a/src/libvterm/t/40state_selection.test b/src/libvterm/t/40state_selection.test
index 6ed8972..a6a3231 100644
--- a/src/libvterm/t/40state_selection.test
+++ b/src/libvterm/t/40state_selection.test
@@ -26,6 +26,30 @@
PUSH "8s\e\\"
selection-set mask=0001 "lo,"]
+!Set clipboard; empty first chunk
+PUSH "\e]52;c;"
+PUSH "SGVsbG8s\e\\"
+ selection-set mask=0001 ["Hello,"]
+
+!Set clipboard; empty final chunk
+PUSH "\e]52;c;SGVsbG8s"
+ selection-set mask=0001 ["Hello,"
+PUSH "\e\\"
+ selection-set mask=0001 ]
+
+!Set clipboard; longer than buffer
+PUSH "\e]52;c;" . "LS0t"x10 . "\e\\"
+ selection-set mask=0001 ["-"x15
+ selection-set mask=0001 "-"x15]
+
+!Clear clipboard
+PUSH "\e]52;c;\e\\"
+ selection-set mask=0001 []
+
+!Set invalid data clears and ignores
+PUSH "\e]52;c;SGVs*SGVsbG8s\e\\"
+ selection-set mask=0001 []
+
!Query clipboard
PUSH "\e]52;c;?\e\\"
selection-query mask=0001
diff --git a/src/libvterm/t/64screen_pen.test b/src/libvterm/t/64screen_pen.test
index 1cb6324..fa15bce 100644
--- a/src/libvterm/t/64screen_pen.test
+++ b/src/libvterm/t/64screen_pen.test
@@ -41,21 +41,31 @@
?screen_cell 0,9 = {0x30} width=1 attrs={S_} fg=rgb(240,240,240) bg=rgb(0,0,0)
?screen_cell 0,10 = {0x32} width=1 attrs={S^} fg=rgb(240,240,240) bg=rgb(0,0,0)
-!EL sets reverse and colours to end of line
+!EL sets only colours to end of line, not other attrs
PUSH "\e[H\e[7;33;44m\e[K"
- ?screen_cell 0,0 = {} width=1 attrs={R} fg=idx(3) bg=idx(4)
- ?screen_cell 0,79 = {} width=1 attrs={R} fg=idx(3) bg=idx(4)
-
-!DECSCNM xors reverse for entire screen
-PUSH "\e[?5h"
?screen_cell 0,0 = {} width=1 attrs={} fg=idx(3) bg=idx(4)
?screen_cell 0,79 = {} width=1 attrs={} fg=idx(3) bg=idx(4)
+
+!DECSCNM xors reverse for entire screen
+PUSH "R\e[?5h"
+ ?screen_cell 0,0 = {0x52} width=1 attrs={} fg=idx(3) bg=idx(4)
?screen_cell 1,0 = {} width=1 attrs={R} fg=rgb(240,240,240) bg=rgb(0,0,0)
PUSH "\e[?5\$p"
output "\e[?5;1\$y"
PUSH "\e[?5l"
- ?screen_cell 0,0 = {} width=1 attrs={R} fg=idx(3) bg=idx(4)
- ?screen_cell 0,79 = {} width=1 attrs={R} fg=idx(3) bg=idx(4)
+ ?screen_cell 0,0 = {0x52} width=1 attrs={R} fg=idx(3) bg=idx(4)
?screen_cell 1,0 = {} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0)
PUSH "\e[?5\$p"
output "\e[?5;2\$y"
+
+!Set default colours
+RESET
+PUSH "ABC\e[31mDEF\e[m"
+ ?screen_cell 0,0 = {0x41} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0)
+ ?screen_cell 0,3 = {0x44} width=1 attrs={} fg=idx(1) bg=rgb(0,0,0)
+SETDEFAULTCOL rgb(252,253,254)
+ ?screen_cell 0,0 = {0x41} width=1 attrs={} fg=rgb(252,253,254) bg=rgb(0,0,0)
+ ?screen_cell 0,3 = {0x44} width=1 attrs={} fg=idx(1) bg=rgb(0,0,0)
+SETDEFAULTCOL rgb(250,250,250) rgb(10,20,30)
+ ?screen_cell 0,0 = {0x41} width=1 attrs={} fg=rgb(250,250,250) bg=rgb(10,20,30)
+ ?screen_cell 0,3 = {0x44} width=1 attrs={} fg=idx(1) bg=rgb(10,20,30)
diff --git a/src/libvterm/t/69screen_reflow.test b/src/libvterm/t/69screen_reflow.test
index 278cc5b..eb7e4e4 100644
--- a/src/libvterm/t/69screen_reflow.test
+++ b/src/libvterm/t/69screen_reflow.test
@@ -77,3 +77,12 @@
?lineinfo 3 =
?screen_row 3 = "> "
?cursor = 3,2
+
+!Cursor goes missing
+# For more context: https://github.com/neovim/neovim/pull/21124
+RESET
+RESIZE 5,5
+RESIZE 3,1
+PUSH "\x1b[2;1Habc\r\n\x1b[H"
+RESIZE 1,1
+ ?cursor = 0,0
diff --git a/src/libvterm/t/harness.c b/src/libvterm/t/harness.c
index d12c120..5285d94 100644
--- a/src/libvterm/t/harness.c
+++ b/src/libvterm/t/harness.c
@@ -82,6 +82,26 @@
printf(")");
}
+static VTermColor strpe_color(char **strp)
+{
+ uint8_t r, g, b, idx;
+ int len = 0;
+ VTermColor col;
+
+ if(sscanf(*strp, "rgb(%hhu,%hhu,%hhu)%n", &r, &g, &b, &len) == 3 && len > 0) {
+ *strp += len;
+ vterm_color_rgb(&col, r, g, b);
+ }
+ else if(sscanf(*strp, "idx(%hhu)%n", &idx, &len) == 1 && len > 0) {
+ *strp += len;
+ vterm_color_indexed(&col, idx);
+ }
+ else
+ vterm_color_rgb(&col, 127, 127, 127);
+
+ return col;
+}
+
static VTerm *vt;
static VTermState *state;
static VTermScreen *screen;
@@ -669,7 +689,10 @@
if(!state) {
state = vterm_obtain_state(vt);
vterm_state_set_callbacks(state, &state_cbs, NULL);
- vterm_state_set_selection_callbacks(state, &selection_cbs, NULL, NULL, 1024);
+ /* In some tests we want to check the behaviour of overflowing the
+ * buffer, so make it nicely small
+ */
+ vterm_state_set_selection_callbacks(state, &selection_cbs, NULL, NULL, 16);
vterm_state_set_bold_highbright(state, 1);
vterm_state_reset(state, 1);
}
@@ -942,6 +965,23 @@
vterm_screen_flush_damage(screen);
}
+ else if(strstartswith(line, "SETDEFAULTCOL ")) {
+ assert(screen);
+ char *linep = line + 14;
+ while(linep[0] == ' ')
+ linep++;
+ VTermColor fg = strpe_color(&linep);
+ if(linep[0]) {
+ while(linep[0] == ' ')
+ linep++;
+ VTermColor bg = strpe_color(&linep);
+
+ vterm_screen_set_default_colors(screen, &fg, &bg);
+ }
+ else
+ vterm_screen_set_default_colors(screen, &fg, NULL);
+ }
+
else if(line[0] == '?') {
if(streq(line, "?cursor")) {
assert(state);