termptyesc: support Unset Tab Stop (only VTE so far) + tests
This commit is contained in:
parent
96bbfd054b
commit
392c04bbe0
|
@ -2940,6 +2940,19 @@ _handle_esc_csi_da(Termpty *ty, Eina_Unicode **ptr)
|
||||||
termpty_write(ty, bf, len);
|
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
|
static int
|
||||||
_handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
_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':
|
case 'c':
|
||||||
_handle_esc_csi_da(ty, &b);
|
_handle_esc_csi_da(ty, &b);
|
||||||
break;
|
break;
|
||||||
case 'd': // to row N
|
case 'd':
|
||||||
arg = _csi_arg_get(ty, &b);
|
if (*(cc-1) == ' ')
|
||||||
if (arg == -CSI_ARG_ERROR)
|
_handle_esc_csi_uts(ty, &b);
|
||||||
goto error;
|
else
|
||||||
if (arg < 1)
|
{
|
||||||
arg = 1;
|
arg = _csi_arg_get(ty, &b);
|
||||||
DBG("to row %d", arg);
|
if (arg == -CSI_ARG_ERROR)
|
||||||
ty->termstate.wrapnext = 0;
|
goto error;
|
||||||
ty->cursor_state.cy = arg - 1;
|
if (arg < 1)
|
||||||
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cy, 0, ty->h);
|
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;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
_handle_esc_csi_cud(ty, &b);
|
_handle_esc_csi_cud(ty, &b);
|
||||||
|
|
|
@ -71,3 +71,4 @@ cbt.sh 417cd352d3eba45d6016df67a0314444
|
||||||
hpa.sh 0f86ca83e072d41b89dd1a012f0749a7
|
hpa.sh 0f86ca83e072d41b89dd1a012f0749a7
|
||||||
rep.sh b91ebb46fb5ebd95aa2cb87ad12bb4ba
|
rep.sh b91ebb46fb5ebd95aa2cb87ad12bb4ba
|
||||||
da.sh 3083fbec33befe5299ca3726a19fcff2
|
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…
Reference in New Issue