From 68787ad524a359634880b7f2e7fe820b881c40af Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Sat, 29 Dec 2018 17:18:39 +0100 Subject: [PATCH] tests/termptyesc: handle DECSACE Also regenerate tests since checksums changed due to new attribute --- src/bin/termpty.h | 1 + src/bin/termptyesc.c | 30 ++++++++++++++++++++++++++++++ src/bin/termptyops.c | 1 + tests/run_tests.sh | 22 ++++++++++++++++++---- tests/tests.results | 4 ++-- 5 files changed, 52 insertions(+), 6 deletions(-) diff --git a/src/bin/termpty.h b/src/bin/termpty.h index dd08f087..7a3aee2e 100644 --- a/src/bin/termpty.h +++ b/src/bin/termpty.h @@ -120,6 +120,7 @@ typedef struct _Term_State { unsigned int cjk_ambiguous_wide : 1; unsigned int hide_cursor : 1; unsigned int combining_strike : 1; + unsigned int sace_rectangular : 1; } Term_State; typedef struct _Term_Cursor { diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c index bfde79c4..e6c64100 100644 --- a/src/bin/termptyesc.c +++ b/src/bin/termptyesc.c @@ -1772,6 +1772,34 @@ _handle_esc_csi_decscusr(Termpty *ty, Eina_Unicode **b) termio_set_cursor_shape(ty->obj, shape); } +static void +_handle_esc_csi_decsace(Termpty *ty, Eina_Unicode **b) +{ + int arg = _csi_arg_get(ty, b); + + DBG("DECSACE (%d) Select Attribute Change Extent", arg); + + switch (arg) + { + case -CSI_ARG_ERROR: + return; + case -CSI_ARG_NO_VALUE: + EINA_FALLTHROUGH; + case 0: + EINA_FALLTHROUGH; + case 1: + ty->termstate.sace_rectangular = 0; + break; + case 2: + ty->termstate.sace_rectangular = 1; + break; + default: + WRN("Invalid DECSACE %d", arg); + ty->decoding_error = EINA_TRUE; + return; + } +} + static int _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce) { @@ -2251,6 +2279,8 @@ HVP: case 'x': if (*(cc-1) == '$') _handle_esc_csi_decfra(ty, &b); + else if (*(cc-1) == '*') + _handle_esc_csi_decsace(ty, &b); break; case 'z': if (*(cc-1) == '$') diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c index ad6bf626..2684e88a 100644 --- a/src/bin/termptyops.c +++ b/src/bin/termptyops.c @@ -459,6 +459,7 @@ termpty_soft_reset_state(Termpty *ty) ty->termstate.no_autorepeat = 0; ty->termstate.cjk_ambiguous_wide = 0; ty->termstate.hide_cursor = 0; + ty->termstate.sace_rectangular = 0; ty->mouse_mode = MOUSE_OFF; ty->mouse_ext = MOUSE_EXT_NONE; ty->bracketed_paste = 0; diff --git a/tests/run_tests.sh b/tests/run_tests.sh index d1750cf3..b743251c 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -7,6 +7,7 @@ RESULTS="tests.results" TESTDIR="." VERBOSE=0 DEBUG=0 +GENRESULTS=0 EXIT_ON_FAILURE=0 NB_TESTS=0 OK_TESTS=0 @@ -73,8 +74,9 @@ where options are: -e, --exitonfailure Exit as soon as a test fails Misc options: - -v, --verbose Be verbose about what is being done. + -v, --verbose Be verbose about what is being done --debug Debug tests + --genresults Output a results file -h, --help Show this help. HELP_EOF } @@ -99,6 +101,9 @@ while [ $# -gt 0 ]; do -debug|--debug) DEBUG=1 ;; + -genresults|--genresults) + GENRESULTS=1 + ;; -t|-tytest|--tytest) if [ -z "$value" ]; then value=$1 @@ -138,6 +143,11 @@ fi if [ ! -d "$TESTDIR" ]; then die "Invalid test directory: $TESTDIR" fi +if [ $GENRESULTS -ne 0 ]; then + DEBUG=0 + VERBOSE=0 +fi + if [ $DEBUG -ne 0 ]; then cat <