aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2019-01-07 23:11:57 +0100
committerBoris Faure <billiob@gmail.com>2019-01-07 23:13:52 +0100
commita2656754bdc5273e3145c119381eb7382ed92174 (patch)
treead3574ebd360c32fe35305c48b695d51c852787a
parenttermptyesc: 'T' can also refer to Unset Title Modes (not handled) (diff)
downloadterminology-a2656754bdc5273e3145c119381eb7382ed92174.tar.gz
termptyesc: support DECST8C + tests
-rw-r--r--src/bin/termptyesc.c37
-rwxr-xr-xtests/decst8c.sh14
-rw-r--r--tests/tests.results1
3 files changed, 52 insertions, 0 deletions
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 3ce48c8..51b8e70 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -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)
diff --git a/tests/decst8c.sh b/tests/decst8c.sh
new file mode 100755
index 0000000..45b0f94
--- /dev/null
+++ b/tests/decst8c.sh
@@ -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#'
diff --git a/tests/tests.results b/tests/tests.results
index 9aeca30..ba29cbd 100644
--- a/tests/tests.results
+++ b/tests/tests.results
@@ -62,3 +62,4 @@ il.sh 1788258650a94f2568d05f749b6cf578
dl.sh e1e0ba19345d2ebf888f5a3e37f27037
su.sh 591185f42b75daa61726217033a17eaf
sd.sh 4bfda7ec3e6192acab077de2bc270525
+decst8c.sh 0ea805e8f4c2626ce66c566a10548d0f