patch 8.2.0804: libvterm code lags behind the upstream version
Problem: Libvterm code lags behind the upstream version.
Solution: Include revision 727, but add the index instead of switching
between RGB and indexed.
diff --git a/src/libvterm/t/harness.c b/src/libvterm/t/harness.c
index fd129b7..10afbfd 100644
--- a/src/libvterm/t/harness.c
+++ b/src/libvterm/t/harness.c
@@ -60,6 +60,26 @@
return VTERM_KEY_NONE;
}
+static void print_color(const VTermColor *col)
+{
+ if (VTERM_COLOR_IS_RGB(col)) {
+ printf("rgb(%d,%d,%d", col->red, col->green, col->blue);
+ }
+ else if (VTERM_COLOR_IS_INDEXED(col)) {
+ printf("idx(%d", col->index);
+ }
+ else {
+ printf("invalid(%d", col->type);
+ }
+ if (VTERM_COLOR_IS_DEFAULT_FG(col)) {
+ printf(",is_default_fg");
+ }
+ if (VTERM_COLOR_IS_DEFAULT_BG(col)) {
+ printf(",is_default_bg");
+ }
+ printf(")");
+}
+
static VTerm *vt;
static VTermState *state;
static VTermScreen *screen;
@@ -273,7 +293,9 @@
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);
+ printf("settermprop %d ", prop);
+ print_color(&val->color);
+ printf("\n");
return 1;
case VTERM_N_VALUETYPES:
@@ -834,10 +856,12 @@
printf("%d\n", state_pen.font);
}
else if(streq(linep, "foreground")) {
- printf("rgb(%d,%d,%d)\n", state_pen.foreground.red, state_pen.foreground.green, state_pen.foreground.blue);
+ print_color(&state_pen.foreground);
+ printf("\n");
}
else if(streq(linep, "background")) {
- printf("rgb(%d,%d,%d)\n", state_pen.background.red, state_pen.background.green, state_pen.background.blue);
+ print_color(&state_pen.background);
+ printf("\n");
}
else
printf("?\n");
@@ -952,8 +976,13 @@
printf("} ");
if(cell.attrs.dwl) printf("dwl ");
if(cell.attrs.dhl) printf("dhl-%s ", cell.attrs.dhl == 2 ? "bottom" : "top");
- printf("fg=rgb(%d,%d,%d) ", cell.fg.red, cell.fg.green, cell.fg.blue);
- printf("bg=rgb(%d,%d,%d)\n", cell.bg.red, cell.bg.green, cell.bg.blue);
+ printf("fg=");
+ vterm_screen_convert_color_to_rgb(screen, &cell.fg);
+ print_color(&cell.fg);
+ printf(" bg=");
+ vterm_screen_convert_color_to_rgb(screen, &cell.bg);
+ print_color(&cell.bg);
+ printf("\n");
}
else if(strstartswith(line, "?screen_eol ")) {
VTermPos pos;