termptyesc: handle CTC + tests

This commit is contained in:
Boris Faure 2019-01-08 22:55:48 +01:00
parent 24cc5eaf8d
commit 395404c243
3 changed files with 49 additions and 2 deletions

View File

@ -2735,8 +2735,25 @@ _handle_esc_csi_ctc(Termpty *ty, Eina_Unicode **ptr)
if (arg == -CSI_ARG_ERROR)
return;
DBG("CTC - Cursor Tab Control: %d", arg);
/* TODO */
switch (arg)
{
case -CSI_ARG_NO_VALUE:
EINA_FALLTHROUGH;
case 0:
TAB_SET(ty, ty->cursor_state.cx);
break;
case 2:
TAB_UNSET(ty, ty->cursor_state.cx);
break;
case 4:
EINA_FALLTHROUGH;
case 5:
termpty_clear_tabs_on_screen(ty);
break;
default:
ERR("invalid CTC argument %d", arg);
ty->decoding_error = EINA_TRUE;
}
}
static int

29
tests/ctc.sh Executable file
View File

@ -0,0 +1,29 @@
#!/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 '\n#\t#\t#\t#\t#\t#\t#\t#\t#\t#\t#'
# remove and add a tab
printf '\n# \033[2W@ \033[0W# \033[W#(One tab removed, two added)'
printf '\n#\t#\t#\t#\t#\t#\t#\t#\t#\t#\t#\t#'
# remove all tabs
printf '\n\033[4WRemove all tabs:'
printf '\n#\t#\t#\t#'
# set tabs
printf '\nAdd them again\033[?5W:'
printf '\r\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 '\n#\t#\t#\t#\t#\t#\t#\t#\t#\t#\t#'
# remove all tabs
printf '\n\033[5WRemove all tabs:'
printf '\n#\t#\t#\t#'

View File

@ -63,3 +63,4 @@ dl.sh e1e0ba19345d2ebf888f5a3e37f27037
su.sh 591185f42b75daa61726217033a17eaf
sd.sh 4bfda7ec3e6192acab077de2bc270525
decst8c.sh 0ea805e8f4c2626ce66c566a10548d0f
ctc.sh d35eeacdb2e99f5ac8cc3c4e8d72f8b0