forked from aniani/vim
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.
This commit is contained in:
@@ -41,10 +41,10 @@ PUSH "\e[0;93;104m"
|
||||
PUSH "\eP\$qm\e\\"
|
||||
output "\eP1\$r93;104m\e\\"
|
||||
|
||||
!DECRQSS on SGR 256-palette colours
|
||||
PUSH "\e[0;38:5:56;48:5:78m"
|
||||
PUSH "\eP\$qm\e\\"
|
||||
output "\eP1\$r38:5:56;48:5:78m\e\\"
|
||||
##!DECRQSS on SGR 256-palette colours
|
||||
#PUSH "\e[0;38:5:56;48:5:78m"
|
||||
#PUSH "\eP\$qm\e\\"
|
||||
# output "\eP1\$r38:5:56;48:5:78m\e\\"
|
||||
|
||||
!DECRQSS on SGR RGB8 colours
|
||||
PUSH "\e[0;38:2:24:68:112;48:2:13:57:101m"
|
||||
|
||||
@@ -10,8 +10,8 @@ PUSH "\e[m"
|
||||
?pen blink = off
|
||||
?pen reverse = off
|
||||
?pen font = 0
|
||||
?pen foreground = rgb(240,240,240)
|
||||
?pen background = rgb(0,0,0)
|
||||
?pen foreground = rgb(240,240,240,is_default_fg)
|
||||
?pen background = rgb(0,0,0,is_default_bg)
|
||||
|
||||
!Bold
|
||||
PUSH "\e[1m"
|
||||
@@ -75,40 +75,40 @@ PUSH "\e[11m\e[m"
|
||||
|
||||
!Foreground
|
||||
PUSH "\e[31m"
|
||||
?pen foreground = rgb(224,0,0)
|
||||
?pen foreground = idx(1)
|
||||
PUSH "\e[32m"
|
||||
?pen foreground = rgb(0,224,0)
|
||||
?pen foreground = idx(2)
|
||||
PUSH "\e[34m"
|
||||
?pen foreground = rgb(0,0,224)
|
||||
?pen foreground = idx(4)
|
||||
PUSH "\e[91m"
|
||||
?pen foreground = rgb(255,64,64)
|
||||
?pen foreground = idx(9)
|
||||
PUSH "\e[38:2:10:20:30m"
|
||||
?pen foreground = rgb(10,20,30)
|
||||
PUSH "\e[38:5:1m"
|
||||
?pen foreground = rgb(224,0,0)
|
||||
?pen foreground = idx(1)
|
||||
PUSH "\e[39m"
|
||||
?pen foreground = rgb(240,240,240)
|
||||
?pen foreground = rgb(240,240,240,is_default_fg)
|
||||
|
||||
!Background
|
||||
PUSH "\e[41m"
|
||||
?pen background = rgb(224,0,0)
|
||||
?pen background = idx(1)
|
||||
PUSH "\e[42m"
|
||||
?pen background = rgb(0,224,0)
|
||||
?pen background = idx(2)
|
||||
PUSH "\e[44m"
|
||||
?pen background = rgb(0,0,224)
|
||||
?pen background = idx(4)
|
||||
PUSH "\e[101m"
|
||||
?pen background = rgb(255,64,64)
|
||||
?pen background = idx(9)
|
||||
PUSH "\e[48:2:10:20:30m"
|
||||
?pen background = rgb(10,20,30)
|
||||
PUSH "\e[48:5:1m"
|
||||
?pen background = rgb(224,0,0)
|
||||
?pen background = idx(1)
|
||||
PUSH "\e[49m"
|
||||
?pen background = rgb(0,0,0)
|
||||
?pen background = rgb(0,0,0,is_default_bg)
|
||||
|
||||
!Bold+ANSI colour == highbright
|
||||
PUSH "\e[m\e[1;37m"
|
||||
?pen bold = on
|
||||
?pen foreground = rgb(255,255,255)
|
||||
?pen foreground = idx(15)
|
||||
PUSH "\e[m\e[37;1m"
|
||||
?pen bold = on
|
||||
?pen foreground = rgb(255,255,255)
|
||||
?pen foreground = idx(15)
|
||||
|
||||
@@ -29,27 +29,27 @@ PUSH "\e[11mF\e[m"
|
||||
|
||||
!Foreground
|
||||
PUSH "\e[31mG\e[m"
|
||||
?screen_cell 0,6 = {0x47} width=1 attrs={} fg=rgb(224,0,0) bg=rgb(0,0,0)
|
||||
?screen_cell 0,6 = {0x47} width=1 attrs={} fg=idx(1) bg=rgb(0,0,0)
|
||||
|
||||
!Background
|
||||
PUSH "\e[42mH\e[m"
|
||||
?screen_cell 0,7 = {0x48} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,224,0)
|
||||
?screen_cell 0,7 = {0x48} width=1 attrs={} fg=rgb(240,240,240) bg=idx(2)
|
||||
|
||||
!EL sets reverse and colours to end of line
|
||||
PUSH "\e[H\e[7;33;44m\e[K"
|
||||
?screen_cell 0,0 = {} width=1 attrs={R} fg=rgb(224,224,0) bg=rgb(0,0,224)
|
||||
?screen_cell 0,79 = {} width=1 attrs={R} fg=rgb(224,224,0) bg=rgb(0,0,224)
|
||||
?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=rgb(224,224,0) bg=rgb(0,0,224)
|
||||
?screen_cell 0,79 = {} width=1 attrs={} fg=rgb(224,224,0) bg=rgb(0,0,224)
|
||||
?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)
|
||||
?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=rgb(224,224,0) bg=rgb(0,0,224)
|
||||
?screen_cell 0,79 = {} width=1 attrs={R} fg=rgb(224,224,0) bg=rgb(0,0,224)
|
||||
?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 1,0 = {} width=1 attrs={} fg=rgb(240,240,240) bg=rgb(0,0,0)
|
||||
PUSH "\e[?5\$p"
|
||||
output "\e[?5;2\$y"
|
||||
|
||||
@@ -60,6 +60,26 @@ static VTermKey strp_key(char *str)
|
||||
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 @@ static int settermprop(VTermProp prop, VTermValue *val, void *user UNUSED)
|
||||
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 @@ int main(int argc UNUSED, char **argv UNUSED)
|
||||
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 @@ int main(int argc UNUSED, char **argv UNUSED)
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user