[vte] parser: Recognise more commands



commit 9c8ba36e8b2744735729f2b2abcb6a66a08705a8
Author: Christian Persch <chpe src gnome org>
Date:   Sat Aug 14 21:45:46 2021 +0200

    parser: Recognise more commands
    
    Add another NOP from WY.

 src/parser-seq.py |  2 ++
 src/vteseq.cc     | 48 ++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 44 insertions(+), 6 deletions(-)
---
diff --git a/src/parser-seq.py b/src/parser-seq.py
index bd973e76..7c600788 100755
--- a/src/parser-seq.py
+++ b/src/parser-seq.py
@@ -805,6 +805,8 @@ sequences = [
             comment='set port parameter'),
     seq_CSI('DECREQTPARM', 'x',
             comment='request terminal parameters'),
+    seq_CSI('WYCDIR', 'x', flags=Flags.NOP,
+            comment='set current character attributes'),
     seq_CSI('DECFRA', 'x', intermediates=(Intermediate.CASH,), flags=Flags.NOP,
             comment='fill rectangular area'),
     seq_CSI('DECES', 'x', intermediates=(Intermediate.AND,), flags=Flags.NOP,
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 8cc29299..531bcfec 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -3451,12 +3451,6 @@ Terminal::DECREQTPARM(vte::parser::Sequence const& seq)
          *   args[0]: 0
          *
          * References: VT100
-         *
-         * Alternatively:
-         *
-         * WYCDIR - set current character color and attributes
-         *
-         * References: WY370
          */
 
         switch (seq.collect1(0)) {
@@ -3483,6 +3477,25 @@ Terminal::DECREQTPARM(vte::parser::Sequence const& seq)
         }
 }
 
+void
+Terminal::DECREQTPARM_OR_WYCDIR(vte::parser::Sequence const& seq)
+{
+        /*
+         * There's a conflict between DECREQTPERM and WYCDIR.
+         * A DECTPARM request (_not_ response!) only has at most one
+         * parameter, while WYCDIR takes three. Although both
+         * commands admit default values to all parameters, using
+         * the number of parameters to disambiguate should be good
+         * enough here.
+         */
+        if (seq.size_final() <= 1)
+                DECREQTPARM(seq);
+#ifdef PARSER_INCLUDE_NOP
+        else
+                WYCDIR(seq);
+#endif
+}
+
 void
 Terminal::DECRQCRA(vte::parser::Sequence const& seq)
 {
@@ -8478,6 +8491,29 @@ Terminal::WYCAA(vte::parser::Sequence const& seq)
         }
 }
 
+void
+Terminal::WYCDIR(vte::parser::Sequence const& seq)
+{
+        /*
+         * WYCDIR - set current character color and attributes
+         * Sets the foreground and background colours used for SGR attributes.
+         *
+         * Arguments:
+         *   args[0]: foreground colour (0…64)
+         *   args[1]: background colour (0…64)
+         *   args[2]: SGR attribute (0…15)
+         *
+         * Defaults:
+         *   args[0]: default foreground colour
+         *   args[1]: default background colour
+         *   args[2]: default attribute (0)
+         *
+         * Probably not worth implementing.
+         *
+         * References: WY370
+         */
+}
+
 void
 Terminal::WYDHL_BH(vte::parser::Sequence const& seq)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]