billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=eab5ffb956a2a7ceb60bac82e51fa0009de2ab44

commit eab5ffb956a2a7ceb60bac82e51fa0009de2ab44
Author: Boris Faure <[email protected]>
Date:   Sun Dec 16 19:08:59 2018 +0100

    termptyesc: 98/108 are not valid color codes + test
---
 src/bin/termptyesc.c | 57 ----------------------------------------------------
 tests/sgr-long.sh    | 10 +++++++++
 tests/tests.results  |  1 +
 3 files changed, 11 insertions(+), 57 deletions(-)

diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 623e7ea..c94e91f 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -1078,35 +1078,6 @@ _handle_esc_csi_color_set(Termpty *ty, Eina_Unicode 
**ptr,
               ty->termstate.att.fg = (arg - 90) + COL_BLACK;
               ty->termstate.att.fgintense = 1;
               break;
-           case 98: // xterm 256 fg color ???
-              // now check if next arg is 5
-              /* TODO: shall be like 38 ? */
-              /* TODO: -CSI_ARG_NO_VALUE */
-              arg = _csi_arg_get(ty, &b);
-              if (arg != 5)
-                {
-                   ERR("Failed xterm 256 color fg esc 5 (got %d)", arg);
-                   ty->decoding_error = EINA_TRUE;
-                }
-              else
-                {
-                   // then get next arg - should be color index 0-255
-                   arg = _csi_arg_get(ty, &b);
-                   if (arg <= -CSI_ARG_ERROR || arg > 255)
-                     {
-                        ERR("Invalid fg color %d", arg);
-                        ty->decoding_error = EINA_TRUE;
-                     }
-                   else
-                     {
-                        if (arg == -CSI_ARG_NO_VALUE)
-                          arg = 0;
-                        ty->termstate.att.fg256 = 1;
-                        ty->termstate.att.fg = arg;
-                     }
-                }
-              ty->termstate.att.fgintense = 1;
-              break;
            case 99: // default fg color
               ty->termstate.att.fg256 = 0;
               ty->termstate.att.fg = COL_DEF;
@@ -1124,34 +1095,6 @@ _handle_esc_csi_color_set(Termpty *ty, Eina_Unicode 
**ptr,
               ty->termstate.att.bg = (arg - 100) + COL_BLACK;
               ty->termstate.att.bgintense = 1;
               break;
-           case 108: // xterm 256 bg color ???
-              // now check if next arg is 5
-              /* TODO: -CSI_ARG_NO_VALUE */
-              arg = _csi_arg_get(ty, &b);
-              if (arg != 5)
-                {
-                   ERR("Failed xterm 256 color bg esc 5 (got %d)", arg);
-                   ty->decoding_error = EINA_TRUE;
-                }
-              else
-                {
-                   // then get next arg - should be color index 0-255
-                   arg = _csi_arg_get(ty, &b);
-                   if (arg <= -CSI_ARG_ERROR || arg > 255)
-                     {
-                        ERR("Invalid bg color %d", arg);
-                        ty->decoding_error = EINA_TRUE;
-                     }
-                   else
-                     {
-                        if (arg == -CSI_ARG_NO_VALUE)
-                          arg = 0;
-                        ty->termstate.att.bg256 = 1;
-                        ty->termstate.att.bg = arg;
-                     }
-                }
-              ty->termstate.att.bgintense = 1;
-              break;
            case 109: // default bg color
               ty->termstate.att.bg256 = 0;
               ty->termstate.att.bg = COL_DEF;
diff --git a/tests/sgr-long.sh b/tests/sgr-long.sh
new file mode 100755
index 0000000..8d38fd7
--- /dev/null
+++ b/tests/sgr-long.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# long sequence
+printf '\033[0;1;2;3;4;5;9;20;38;5;58;48;5;34;52;53mo'
+# long sequence with 98/108 which are not allowed, were producing the same
+printf '\033[0;1;2;3;4;5;9;20;98;5;58;108;5;34;52;53mo'
+printf '\n'
+# both shall provide the same output
+printf '\033[0;5;58;5;34mo\033[0;98;5;58;108;5;34mo'
+
diff --git a/tests/tests.results b/tests/tests.results
index 182cac2..4442b13 100644
--- a/tests/tests.results
+++ b/tests/tests.results
@@ -28,3 +28,4 @@ dsr-udk.sh f3a20968a2f25bfd36875dbc5f64ab16
 colors.sh 532494a2e56c102ee10ab1a9b8f176d7
 sgr-leading-trailing-semicolon.sh d7701f1193bde63412a9b969f17e10ec
 sgr-truecolors.sh 9db4becc728bb9f1730f3573dc7fc668
+sgr-long.sh ec0425b1daabaa59096c10939e79b105

-- 


Reply via email to