termptyesc: support Unset Tab Stop (only VTE so far) + tests

terminology-1.4
Boris Faure 4 years ago
parent 96bbfd054b
commit 392c04bbe0
  1. 38
      src/bin/termptyesc.c
  2. 1
      tests/tests.results
  3. 20
      tests/uts.sh

@ -2940,6 +2940,19 @@ _handle_esc_csi_da(Termpty *ty, Eina_Unicode **ptr)
termpty_write(ty, bf, len);
}
static void
_handle_esc_csi_uts(Termpty *ty, Eina_Unicode **ptr)
{
Eina_Unicode *b = *ptr;
int arg = _csi_arg_get(ty, &b);
if (arg == -CSI_ARG_ERROR)
return;
DBG("UTS - Unset Tab Stop: %d", arg);
TERMPTY_RESTRICT_FIELD(arg, 0, ty->w);
TAB_UNSET(ty, arg);
}
static int
_handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
{
@ -3059,16 +3072,21 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
case 'c':
_handle_esc_csi_da(ty, &b);
break;
case 'd': // to row N
arg = _csi_arg_get(ty, &b);
if (arg == -CSI_ARG_ERROR)
goto error;
if (arg < 1)
arg = 1;
DBG("to row %d", arg);
ty->termstate.wrapnext = 0;
ty->cursor_state.cy = arg - 1;
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cy, 0, ty->h);
case 'd':
if (*(cc-1) == ' ')
_handle_esc_csi_uts(ty, &b);
else
{
arg = _csi_arg_get(ty, &b);
if (arg == -CSI_ARG_ERROR)
goto error;
if (arg < 1)
arg = 1;
DBG("to row %d", arg);
ty->termstate.wrapnext = 0;
ty->cursor_state.cy = arg - 1;
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cy, 0, ty->h);
}
break;
case 'e':
_handle_esc_csi_cud(ty, &b);

@ -71,3 +71,4 @@ cbt.sh 417cd352d3eba45d6016df67a0314444
hpa.sh 0f86ca83e072d41b89dd1a012f0749a7
rep.sh b91ebb46fb5ebd95aa2cb87ad12bb4ba
da.sh 3083fbec33befe5299ca3726a19fcff2
uts.sh 1c72fe49e7f98aac137d436ac4906bc8

@ -0,0 +1,20 @@
#!/bin/sh
# fill space with E
printf '\033#8'
# set color
printf '\033[46;31;3m'
# move to 0;0
printf '\033[H'
# set tabs
printf '\033H\033H\033[3C\033[W\033[4C\033[0W\033[5C\033H\033[6C\033H'
printf '\033[7C\033H\033[8C\033H\033[9C'
printf '\nTabs set:'
# show # on tabs
printf '\n#\t#\t#\t#\t#\t#\t#\t#\t#\t#\t#'
printf '\nRemoved tab on position 3'
# remove tab on col 0 (has no effect)
printf '\033[ d'
# remove tab on col 3
printf '\033[3 d'
printf '\n#\t#\t#\t#\t#\t#\t#\t#\t#\t#\t#'
Loading…
Cancel
Save