[vte] emulation: Fix absolute cursor movement with missing row number



commit ad82b82c2612240ee7aa58df9e58245535fc90b7
Author: Egmont Koblinger <egmont gmail com>
Date:   Sun May 18 19:44:53 2014 +0200

    emulation: Fix absolute cursor movement with missing row number

 src/caps.c         |   13 ++++++++-----
 src/vteseq-n.gperf |    2 +-
 src/vteseq.c       |   20 +++++++++++++-------
 3 files changed, 22 insertions(+), 13 deletions(-)
---
diff --git a/src/caps.c b/src/caps.c
index acc34bc..109a461 100644
--- a/src/caps.c
+++ b/src/caps.c
@@ -109,10 +109,11 @@ struct _vte_capability_string _vte_xterm_capability_strings[] = {
        {CSI "%dF", "cursor-preceding-line", 0},
        {CSI "G", "cursor-character-absolute", 0},
        {CSI "%dG", "cursor-character-absolute", 0},
+        {CSI "H", "cursor-position", 0},
        {CSI ";H", "cursor-position", 0},
        {CSI "%dH", "cursor-position", 0},
        {CSI "%d;H", "cursor-position", 0},
-       {CSI ";%dH", "cursor-position", 0},
+        {CSI ";%dH", "cursor-position-top-row", 0},
        {CSI "%d;%dH", "cursor-position", 0},
        {CSI "I", "cursor-forward-tabulation", 0},
        {CSI "J", "erase-in-display", 0},
@@ -152,10 +153,12 @@ struct _vte_capability_string _vte_xterm_capability_strings[] = {
        {CSI "?%mc", "linux-console-cursor-attributes", 0},
        {CSI "d", "line-position-absolute", 0},
        {CSI "%dd", "line-position-absolute", 0},
-       {CSI ";f", "horizontal-and-vertical-position", 0},
-       {CSI "%d;f", "horizontal-and-vertical-position", 0},
-       {CSI ";%df", "horizontal-and-vertical-position", 0},
-       {CSI "%d;%df", "horizontal-and-vertical-position", 0},
+        {CSI "f", "cursor-position", 0},
+        {CSI ";f", "cursor-position", 0},
+        {CSI "%df", "cursor-position", 0},
+        {CSI "%d;f", "cursor-position", 0},
+        {CSI ";%df", "cursor-position-top-row", 0},
+        {CSI "%d;%df", "cursor-position", 0},
        {CSI "g", "tab-clear", 0},
        {CSI "%dg", "tab-clear", 0},
 
diff --git a/src/vteseq-n.gperf b/src/vteseq-n.gperf
index 388c98f..fff6e7b 100644
--- a/src/vteseq-n.gperf
+++ b/src/vteseq-n.gperf
@@ -64,6 +64,7 @@ struct vteseq_n_struct {
 "cursor-back-tab", VTE_SEQUENCE_HANDLER(vte_sequence_handler_bt)
 "cursor-backward", VTE_SEQUENCE_HANDLER(vte_sequence_handler_LE)
 "cursor-position", VTE_SEQUENCE_HANDLER(vte_sequence_handler_cursor_position)
+"cursor-position-top-row", VTE_SEQUENCE_HANDLER(vte_sequence_handler_cursor_position_top_row)
 #"single-shift-g2", VTE_SEQUENCE_HANDLER_NULL
 #"single-shift-g3", VTE_SEQUENCE_HANDLER_NULL
 #"change-font-name", VTE_SEQUENCE_HANDLER_NULL
@@ -145,7 +146,6 @@ struct vteseq_n_struct {
 #"initiate-hilite-mouse-tracking", VTE_SEQUENCE_HANDLER_NULL
 "send-primary-device-attributes", VTE_SEQUENCE_HANDLER(vte_sequence_handler_send_primary_device_attributes)
 "linux-console-cursor-attributes", VTE_SEQUENCE_HANDLER(vte_sequence_handler_noop)
-"horizontal-and-vertical-position", 
VTE_SEQUENCE_HANDLER(vte_sequence_handler_horizontal_and_vertical_position)
 "send-secondary-device-attributes", 
VTE_SEQUENCE_HANDLER(vte_sequence_handler_send_secondary_device_attributes)
 #"change-mouse-cursor-background-colors-bel", VTE_SEQUENCE_HANDLER_NULL
 #"change-mouse-cursor-background-colors-st", VTE_SEQUENCE_HANDLER_NULL
diff --git a/src/vteseq.c b/src/vteseq.c
index 186ea28..b404b93 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -1586,13 +1586,6 @@ vte_sequence_handler_ho (VteTerminal *terminal, GValueArray *params)
        _vte_terminal_home_cursor (terminal);
 }
 
-/* Move the cursor to a specified position. */
-static void
-vte_sequence_handler_horizontal_and_vertical_position (VteTerminal *terminal, GValueArray *params)
-{
-       vte_sequence_handler_offset(terminal, params, -1, vte_sequence_handler_cm);
-}
-
 /* Insert a character. */
 static void
 vte_sequence_handler_ic (VteTerminal *terminal, GValueArray *params)
@@ -2589,6 +2582,19 @@ vte_sequence_handler_cursor_position (VteTerminal *terminal, GValueArray *params
        vte_sequence_handler_offset(terminal, params, -1, vte_sequence_handler_cm);
 }
 
+static void
+vte_sequence_handler_cursor_position_top_row (VteTerminal *terminal, GValueArray *params)
+{
+        GValue value = {0};
+
+        g_value_init (&value, G_TYPE_LONG);
+        g_value_set_long (&value, 1);
+
+        g_value_array_insert (params, 0, &value);
+
+        vte_sequence_handler_offset(terminal, params, -1, vte_sequence_handler_cm);
+}
+
 /* Request terminal attributes. */
 static void
 vte_sequence_handler_request_terminal_parameters (VteTerminal *terminal, GValueArray *params)


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