termptyesc: handle empty CSI SRG 38/48

+ tests
This commit is contained in:
Boris Faure 2023-03-25 20:06:51 +01:00
parent 5409097373
commit bbcedcb95f
Signed by: borisfaure
GPG Key ID: EAA9CD729F522998
3 changed files with 44 additions and 2 deletions

View File

@ -1069,8 +1069,9 @@ _handle_esc_csi_color_set(Termpty *ty, Eina_Unicode **ptr,
switch (arg)
{
case -ESC_ARG_ERROR:
EINA_FALLTHROUGH;
case -ESC_ARG_NO_VALUE:
return;
/* TODO: -ESC_ARG_NO_VALUE */
case 1:
ty->termstate.att.fg256 = 0;
ty->termstate.att.fg = COL_INVIS;
@ -1140,8 +1141,9 @@ _handle_esc_csi_color_set(Termpty *ty, Eina_Unicode **ptr,
switch (arg)
{
case -ESC_ARG_ERROR:
EINA_FALLTHROUGH;
case -ESC_ARG_NO_VALUE:
return;
/* TODO: -ESC_ARG_NO_VALUE */
case 1:
ty->termstate.att.bg256 = 0;
ty->termstate.att.bg = COL_INVIS;

39
tests/csi-38-no-value.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
# clear screen
printf '\033[2J'
# fill space with E
printf '\033#8'
##
# Test foreground
##
# move
printf '\033[4;4H'
# set color
printf '\033[m\033[46;31;3m'
printf 'foo'
#set RGB
printf '\033[48:2:244:144:25;38:2:56:150:199m'
printf 'bar'
printf '\033[1;38m'
printf 'qux'
##
# Test background
##
# move
printf '\033[8;4H'
# set color
printf '\033[m\033[46;31;3m'
printf 'foo'
#set RGB
printf '\033[48:2:244:144:25;38:2:56:150:199m'
printf 'bar'
printf '\033[1;48m'
printf 'qux'

View File

@ -152,3 +152,4 @@ xterm-colors-sharp.sh d35dc9a85f2e1f5b5be9a9d9bb876af7
xterm-colors-rgb.sh 29145c3cb5960cbec2559f20c17e9a6c
xterm-colors-rgbi.sh 29145c3cb5960cbec2559f20c17e9a6c
xterm-set-cursor-color.sh bb605a08705dce5456c825697cb62be3
csi-38-no-value.sh 62a4f10751b13322fb048f8754d4c2ae