[vte] emulation: Port CBT, CHT to new parameter glue



commit a85c4d30dbc7c97cddf1d47ccfe4bc68a1f9eeb5
Author: Christian Persch <chpe src gnome org>
Date:   Tue Mar 27 19:40:12 2018 +0200

    emulation: Port CBT, CHT to new parameter glue

 src/vteseq-list.hh |    2 -
 src/vteseq.cc      |   62 ++++++++++++++++++++++-----------------------------
 2 files changed, 27 insertions(+), 37 deletions(-)
---
diff --git a/src/vteseq-list.hh b/src/vteseq-list.hh
index 944e6de..072e6b5 100644
--- a/src/vteseq-list.hh
+++ b/src/vteseq-list.hh
@@ -30,8 +30,6 @@ SEQUENCE_HANDLER(change_tek_cursor_color_bel)
 SEQUENCE_HANDLER(change_tek_cursor_color_st)
 SEQUENCE_HANDLER(change_tek_foreground_color_bel)
 SEQUENCE_HANDLER(change_tek_foreground_color_st)
-SEQUENCE_HANDLER(cursor_back_tab)
-SEQUENCE_HANDLER(cursor_forward_tabulation)
 SEQUENCE_HANDLER(cursor_lower_left)
 SEQUENCE_HANDLER(dec_media_copy)
 SEQUENCE_HANDLER(decreset)
diff --git a/src/vteseq.cc b/src/vteseq.cc
index b314cfb..31e0e87 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -913,29 +913,6 @@ VteTerminalPrivate::seq_bell(vte::parser::Params const& params)
         m_bell_pending = true;
 }
 
-/* Backtab. */
-void
-VteTerminalPrivate::seq_cursor_back_tab(vte::parser::Params const& params)
-{
-       /* Calculate which column is the previous tab stop. */
-        auto newcol = m_screen->cursor.col;
-
-       if (m_tabstops) {
-               /* Find the next tabstop. */
-               while (newcol > 0) {
-                       newcol--;
-                        if (get_tabstop(newcol % m_column_count)) {
-                               break;
-                       }
-               }
-       }
-
-       /* Warp the cursor. */
-       _vte_debug_print(VTE_DEBUG_PARSER,
-                       "Moving cursor to column %ld.\n", (long)newcol);
-        set_cursor_column(newcol);
-}
-
 /* Clear from the cursor position (inclusive!) to the beginning of the line. */
 void
 VteTerminalPrivate::clear_to_bol()
@@ -1611,16 +1588,6 @@ VteTerminalPrivate::move_cursor_tab()
        }
 }
 
-void
-VteTerminalPrivate::seq_cursor_forward_tabulation(vte::parser::Params const& params)
-{
-        auto val = std::max(std::min(params.number_or_default_at(0, 1),
-                                     int(m_column_count - m_screen->cursor.col)),
-                            int(1));
-        for (auto i = 0; i < val; i++)
-                move_cursor_tab();
-}
-
 /* Clear tabs selectively. */
 void
 VteTerminalPrivate::seq_tab_clear(vte::parser::Params const& params)
@@ -2682,6 +2649,8 @@ VteTerminalPrivate::CBT(vte::parser::Sequence const& seq)
          *
          * Defaults:
          *   args[0]: 1
+         *
+         * References: ECMA-48 § 8.3.7
          */
 #if 0
 
@@ -2694,7 +2663,25 @@ VteTerminalPrivate::CBT(vte::parser::Sequence const& seq)
         screen_cursor_left_tab(screen, num);
 #endif
 
-        seq_cursor_back_tab(seq);
+        // FIXMEchpe! need to support the parameter!!!
+
+       /* Calculate which column is the previous tab stop. */
+        auto newcol = m_screen->cursor.col;
+
+       if (m_tabstops) {
+               /* Find the next tabstop. */
+               while (newcol > 0) {
+                       newcol--;
+                        if (get_tabstop(newcol % m_column_count)) {
+                               break;
+                       }
+               }
+       }
+
+       /* Warp the cursor. */
+       _vte_debug_print(VTE_DEBUG_PARSER,
+                       "Moving cursor to column %ld.\n", (long)newcol);
+        set_cursor_column(newcol);
 }
 
 void
@@ -2740,6 +2727,8 @@ VteTerminalPrivate::CHT(vte::parser::Sequence const& seq)
          *
          * Defaults:
          *   args[0]: 1
+         *
+         * References: ECMA-48 § 8.3.10
          */
 #if 0
         unsigned int num = 1;
@@ -2751,7 +2740,10 @@ VteTerminalPrivate::CHT(vte::parser::Sequence const& seq)
         screen_cursor_right_tab(screen, num);
 #endif
 
-        seq_cursor_forward_tabulation(seq);
+        auto const val = seq.collect1(0, 1, 1, int(m_column_count - m_screen->cursor.col));
+        // FIXMEchpe stop when cursor.col reaches m_column_count!
+        for (auto i = 0; i < val; i++)
+                move_cursor_tab();
 }
 
 void


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