aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2019-01-08 22:55:48 +0100
committerBoris Faure <billiob@gmail.com>2019-01-08 22:55:48 +0100
commit395404c243ab97817721f3e62ae1b080c89dd3ec (patch)
tree8597d9fdb9875417a2c2744b6af15ab7fe61e46c
parenttermptyesc: Printer and Selective Erase are not supported (diff)
downloadterminology-395404c243ab97817721f3e62ae1b080c89dd3ec.tar.gz
termptyesc: handle CTC + tests
-rw-r--r--src/bin/termptyesc.c21
-rwxr-xr-xtests/ctc.sh29
-rw-r--r--tests/tests.results1
3 files changed, 49 insertions, 2 deletions
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 4c13670..dae3b74 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -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
diff --git a/tests/ctc.sh b/tests/ctc.sh
new file mode 100755
index 0000000..6fd5773
--- /dev/null
+++ b/tests/ctc.sh
@@ -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#'
diff --git a/tests/tests.results b/tests/tests.results
index ba29cbd..e97ef43 100644
--- a/tests/tests.results
+++ b/tests/tests.results
@@ -63,3 +63,4 @@ dl.sh e1e0ba19345d2ebf888f5a3e37f27037
su.sh 591185f42b75daa61726217033a17eaf
sd.sh 4bfda7ec3e6192acab077de2bc270525
decst8c.sh 0ea805e8f4c2626ce66c566a10548d0f
+ctc.sh d35eeacdb2e99f5ac8cc3c4e8d72f8b0