termptyesc: support DECST8C + tests

This commit is contained in:
Boris Faure 2019-01-07 23:11:57 +01:00
parent 19631a70f6
commit a2656754bd
3 changed files with 52 additions and 0 deletions

View File

@ -2700,6 +2700,37 @@ _handle_xterm_unset_title_modes(Termpty *ty EINA_UNUSED,
DBG("Unset Title Modes: TODO");
}
static void
_handle_esc_csi_decst8c(Termpty *ty, Eina_Unicode **ptr)
{
Eina_Unicode *b = *ptr;
int arg = _csi_arg_get(ty, &b);
int i;
if (arg == -CSI_ARG_ERROR)
return;
if ((arg != -CSI_ARG_NO_VALUE) && (arg != 5))
return;
DBG("DECST8C - Set Tab at Every 8 Columns: %d", arg);
termpty_clear_tabs_on_screen(ty);
for (i = 0; i < ty->w; i += TAB_WIDTH)
{
TAB_SET(ty, i);
}
}
static void
_handle_esc_csi_ctc(Termpty *ty, Eina_Unicode **ptr)
{
Eina_Unicode *b = *ptr;
int arg = _csi_arg_get(ty, &b);
if (arg == -CSI_ARG_ERROR)
return;
DBG("CTC - Cursor Tab Control: %d", arg);
/* TODO */
}
static int
_handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
@ -2793,6 +2824,12 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
else
_handle_esc_csi_sd(ty, &b);
break;
case 'W':
if (*b == '?')
_handle_esc_csi_decst8c(ty, &b);
else
_handle_esc_csi_ctc(ty, &b);
break;
case 'X': // erase N chars
arg = _csi_arg_get(ty, &b);
if (arg == -CSI_ARG_ERROR)

14
tests/decst8c.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
# fill space with E
printf '\033#8'
# set color
printf '\033[46;31;3m'
# set tabs
printf '\033H\033H\033[3C\033H\033[4C\033H\033[5C\033H\033[6C\033H'
printf '\033[7C\033H\033[8C\033H\033[9C'
# show # on tabs
printf '\n#\t#\t#\t#\t#\t#\t#\t#\t#\t#\t#'
printf '\n#\t#\t#\t#\t#\t#\t#\t#\t#\t#\t#'
printf '\033[?5W'
printf '\n#\t#\t#\t#\t#\t#\t#\t#\t#\t#\t#'

View File

@ -62,3 +62,4 @@ il.sh 1788258650a94f2568d05f749b6cf578
dl.sh e1e0ba19345d2ebf888f5a3e37f27037
su.sh 591185f42b75daa61726217033a17eaf
sd.sh 4bfda7ec3e6192acab077de2bc270525
decst8c.sh 0ea805e8f4c2626ce66c566a10548d0f