aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2019-01-01 20:32:45 +0100
committerBoris Faure <billiob@gmail.com>2019-01-01 20:32:45 +0100
commitf7576fb01c1a9dac77063669f3f65b1d01b2666b (patch)
treec16e37dba5bad10f8920c9514869e2058c8e47bf /src
parenttests: CUP: test going outside margins (diff)
downloadterminology-f7576fb01c1a9dac77063669f3f65b1d01b2666b.tar.gz
termptyesc: move CHT handler to its own function
Diffstat (limited to 'src')
-rw-r--r--src/bin/termptyesc.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 8c1d5a3..eb26b88 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -2480,6 +2480,19 @@ _handle_esc_csi_cha(Termpty *ty, Eina_Unicode **ptr)
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, min, max);
}
+static void
+_handle_esc_csi_cht(Termpty *ty, Eina_Unicode **ptr)
+{
+ Eina_Unicode *b = *ptr;
+ int arg = _csi_arg_get(ty, &b);
+
+ if (arg == -CSI_ARG_ERROR)
+ return;
+ TERMPTY_RESTRICT_FIELD(arg, 1, ty->w);
+ DBG("CHT - Cursor Forward Tabulation: %d", arg);
+ _tab_forward(ty, arg);
+}
+
static int
_handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
{
@@ -2540,12 +2553,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
_handle_esc_csi_cursor_pos_set(ty, &b, cc);
break;
case 'I':
- arg = _csi_arg_get(ty, &b);
- if (arg == -CSI_ARG_ERROR)
- goto error;
- TERMPTY_RESTRICT_FIELD(arg, 1, ty->w);
- DBG("Cursor Forward Tabulation (CHT): %d", arg);
- _tab_forward(ty, arg);
+ _handle_esc_csi_cht(ty, &b);
break;
case 'J':
if (*b == '?')