[vte/vte-0-36] emulation: Make OSC response use the same terminator as the query
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-0-36] emulation: Make OSC response use the same terminator as the query
- Date: Thu, 23 Jan 2014 23:56:36 +0000 (UTC)
commit ccfc082df82c10fbe91848de16ba8ac45dcd5ce1
Author: Egmont Koblinger <egmont gmail com>
Date: Fri Jan 24 00:54:23 2014 +0100
emulation: Make OSC response use the same terminator as the query
https://bugzilla.gnome.org/show_bug.cgi?id=722446
src/caps.c | 44 +++++++++++++-------------
src/vteseq-n.gperf | 33 +++++++++++++------
src/vteseq.c | 89 ++++++++++++++++++++++++++++++++++++++++------------
3 files changed, 113 insertions(+), 53 deletions(-)
---
diff --git a/src/caps.c b/src/caps.c
index f5e6511..137cea5 100644
--- a/src/caps.c
+++ b/src/caps.c
@@ -523,19 +523,19 @@ struct _vte_capability_string _vte_xterm_capability_strings[] = {
{OSC "1;%s" BEL, "set-icon-title", 0},
{OSC "2;%s" BEL, "set-window-title", 0},
{OSC "3;%s" BEL, "set-xproperty", 0},
- {OSC "4;%s" BEL, "change-color", 0},
+ {OSC "4;%s" BEL, "change-color-bel", 0},
{OSC "6;%s" BEL, "set-current-file-uri", 0},
{OSC "7;%s" BEL, "set-current-directory-uri", 0},
- {OSC "10;%s" BEL, "change-foreground-colors", 0},
- {OSC "11;%s" BEL, "change-background-colors", 0},
- {OSC "12;%s" BEL, "change-cursor-colors", 0},
- {OSC "13;%s" BEL, "change-mouse-cursor-foreground-colors", 0},
- {OSC "14;%s" BEL, "change-mouse-cursor-background-colors", 0},
- {OSC "15;%s" BEL, "change-tek-foreground-colors", 0},
- {OSC "16;%s" BEL, "change-tek-background-colors", 0},
- {OSC "17;%s" BEL, "change-highlight-background-colors", 0},
- {OSC "18;%s" BEL, "change-tek-cursor-colors", 0},
- {OSC "19;%s" BEL, "change-highlight-foreground-colors", 0},
+ {OSC "10;%s" BEL, "change-foreground-colors-bel", 0},
+ {OSC "11;%s" BEL, "change-background-colors-bel", 0},
+ {OSC "12;%s" BEL, "change-cursor-colors-bel", 0},
+ {OSC "13;%s" BEL, "change-mouse-cursor-foreground-colors-bel", 0},
+ {OSC "14;%s" BEL, "change-mouse-cursor-background-colors-bel", 0},
+ {OSC "15;%s" BEL, "change-tek-foreground-colors-bel", 0},
+ {OSC "16;%s" BEL, "change-tek-background-colors-bel", 0},
+ {OSC "17;%s" BEL, "change-highlight-background-colors-bel", 0},
+ {OSC "18;%s" BEL, "change-tek-cursor-colors-bel", 0},
+ {OSC "19;%s" BEL, "change-highlight-foreground-colors-bel", 0},
{OSC "46;%s" BEL, "change-logfile", 0},
{OSC "50;#%d" BEL, "change-font-number", 0},
{OSC "50;%s" BEL, "change-font-name", 0},
@@ -558,19 +558,19 @@ struct _vte_capability_string _vte_xterm_capability_strings[] = {
{OSC "1;%s" ST, "set-icon-title", 0},
{OSC "2;%s" ST, "set-window-title", 0},
{OSC "3;%s" ST, "set-xproperty", 0},
- {OSC "4;%s" ST, "change-color", 0},
+ {OSC "4;%s" ST, "change-color-st", 0},
{OSC "6;%s" ST, "set-current-file-uri", 0},
{OSC "7;%s" ST, "set-current-directory-uri", 0},
- {OSC "10;%s" ST, "change-foreground-colors", 0},
- {OSC "11;%s" ST, "change-background-colors", 0},
- {OSC "12;%s" ST, "change-cursor-colors", 0},
- {OSC "13;%s" ST, "change-mouse-cursor-foreground-colors", 0},
- {OSC "14;%s" ST, "change-mouse-cursor-background-colors", 0},
- {OSC "15;%s" ST, "change-tek-foreground-colors", 0},
- {OSC "16;%s" ST, "change-tek-background-colors", 0},
- {OSC "17;%s" ST, "change-highlight-background-colors", 0},
- {OSC "18;%s" ST, "change-tek-cursor-colors", 0},
- {OSC "19;%s" ST, "change-highlight-foreground-colors", 0},
+ {OSC "10;%s" ST, "change-foreground-colors-st", 0},
+ {OSC "11;%s" ST, "change-background-colors-st", 0},
+ {OSC "12;%s" ST, "change-cursor-colors-st", 0},
+ {OSC "13;%s" ST, "change-mouse-cursor-foreground-colors-st", 0},
+ {OSC "14;%s" ST, "change-mouse-cursor-background-colors-st", 0},
+ {OSC "15;%s" ST, "change-tek-foreground-colors-st", 0},
+ {OSC "16;%s" ST, "change-tek-background-colors-st", 0},
+ {OSC "17;%s" ST, "change-highlight-background-colors-st", 0},
+ {OSC "18;%s" ST, "change-tek-cursor-colors-st", 0},
+ {OSC "19;%s" ST, "change-highlight-foreground-colors-st", 0},
{OSC "46;%s" ST, "change-logfile", 0},
{OSC "50;#%d" ST, "change-font-number", 0},
{OSC "50;%s" ST, "change-font-name", 0},
diff --git a/src/vteseq-n.gperf b/src/vteseq-n.gperf
index fb5b151..050e83e 100644
--- a/src/vteseq-n.gperf
+++ b/src/vteseq-n.gperf
@@ -41,7 +41,8 @@ struct vteseq_n_struct {
#"memory-lock", VTE_SEQUENCE_HANDLER_NULL
"save-cursor", VTE_SEQUENCE_HANDLER(vte_sequence_handler_sc)
"scroll-down", VTE_SEQUENCE_HANDLER(vte_sequence_handler_scroll_down)
-"change-color", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_color)
+"change-color-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_color_bel)
+"change-color-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_color_st)
"reset-color", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_color)
"delete-lines", VTE_SEQUENCE_HANDLER(vte_sequence_handler_delete_lines)
#"double-width", VTE_SEQUENCE_HANDLER_NULL
@@ -78,7 +79,8 @@ struct vteseq_n_struct {
#"end-of-guarded-area", VTE_SEQUENCE_HANDLER_NULL
"utf-8-character-set", VTE_SEQUENCE_HANDLER(vte_sequence_handler_utf_8_charset)
"window-manipulation", VTE_SEQUENCE_HANDLER(vte_sequence_handler_window_manipulation)
-"change-cursor-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_color)
+"change-cursor-colors-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_color_bel)
+"change-cursor-colors-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_color_st)
"reset-cursor-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_cursor_color)
"character-attributes", VTE_SEQUENCE_HANDLER(vte_sequence_handler_character_attributes)
"device-status-report", VTE_SEQUENCE_HANDLER(vte_sequence_handler_device_status_report)
@@ -96,9 +98,11 @@ struct vteseq_n_struct {
#"double-height-top-half", VTE_SEQUENCE_HANDLER_NULL
"line-position-absolute", VTE_SEQUENCE_HANDLER(vte_sequence_handler_line_position_absolute)
"return-terminal-status", VTE_SEQUENCE_HANDLER(vte_sequence_handler_return_terminal_status)
-"change-highlight-background-colors",
VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_highlight_background_color)
+"change-highlight-background-colors-bel",
VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_highlight_background_color_bel)
+"change-highlight-background-colors-st",
VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_highlight_background_color_st)
"reset-highlight-background-colors",
VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_highlight_background_color)
-#"change-highlight-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
+#"change-highlight-foreground-colors-bel", VTE_SEQUENCE_HANDLER_NULL
+#"change-highlight-foreground-colors-st", VTE_SEQUENCE_HANDLER_NULL
#"reset-highlight-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
#"enable-filter-rectangle", VTE_SEQUENCE_HANDLER_NULL
"insert-blank-characters", VTE_SEQUENCE_HANDLER(vte_sequence_handler_insert_blank_characters)
@@ -109,9 +113,11 @@ struct vteseq_n_struct {
#"ansi-conformance-level-1", VTE_SEQUENCE_HANDLER_NULL
#"ansi-conformance-level-2", VTE_SEQUENCE_HANDLER_NULL
#"ansi-conformance-level-3", VTE_SEQUENCE_HANDLER_NULL
-"change-background-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_background_color)
+"change-background-colors-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_background_color_bel)
+"change-background-colors-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_background_color_st)
"reset-background-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_background_color)
-"change-foreground-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_foreground_color)
+"change-foreground-colors-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_foreground_color_bel)
+"change-foreground-colors-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_foreground_color_st)
"reset-foreground-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_foreground_color)
"dec-device-status-report", VTE_SEQUENCE_HANDLER(vte_sequence_handler_dec_device_status_report)
#"enable-locator-reporting", VTE_SEQUENCE_HANDLER_NULL
@@ -124,11 +130,14 @@ struct vteseq_n_struct {
"character-position-absolute", VTE_SEQUENCE_HANDLER(vte_sequence_handler_character_position_absolute)
"request-terminal-parameters", VTE_SEQUENCE_HANDLER(vte_sequence_handler_request_terminal_parameters)
#"select-character-protection", VTE_SEQUENCE_HANDLER_NULL
-#"change-tek-background-colors", VTE_SEQUENCE_HANDLER_NULL
+#"change-tek-background-colors-bel", VTE_SEQUENCE_HANDLER_NULL
+#"change-tek-background-colors-st", VTE_SEQUENCE_HANDLER_NULL
#"reset-tek-background-colors", VTE_SEQUENCE_HANDLER_NULL
-#"change-tek-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
+#"change-tek-foreground-colors-bel", VTE_SEQUENCE_HANDLER_NULL
+#"change-tek-foreground-colors-st", VTE_SEQUENCE_HANDLER_NULL
#"reset-tek-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
-#"change-tek-cursor-colors", VTE_SEQUENCE_HANDLER_NULL
+#"change-tek-cursor-colors-bel", VTE_SEQUENCE_HANDLER_NULL
+#"change-tek-cursor-colors-st", VTE_SEQUENCE_HANDLER_NULL
#"reset-tek-cursor-colors", VTE_SEQUENCE_HANDLER_NULL
#"invoke-g1-character-set-as-gr", VTE_SEQUENCE_HANDLER_NULL
#"invoke-g2-character-set-as-gr", VTE_SEQUENCE_HANDLER_NULL
@@ -138,9 +147,11 @@ struct vteseq_n_struct {
"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", VTE_SEQUENCE_HANDLER_NULL
+#"change-mouse-cursor-background-colors-bel", VTE_SEQUENCE_HANDLER_NULL
+#"change-mouse-cursor-background-colors-st", VTE_SEQUENCE_HANDLER_NULL
#"reset-mouse-cursor-background-colors", VTE_SEQUENCE_HANDLER_NULL
-#"change-mouse-cursor-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
+#"change-mouse-cursor-foreground-colors-bel", VTE_SEQUENCE_HANDLER_NULL
+#"change-mouse-cursor-foreground-colors-st", VTE_SEQUENCE_HANDLER_NULL
#"reset-mouse-cursor-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
"set-current-directory-uri", VTE_SEQUENCE_HANDLER(vte_sequence_handler_set_current_directory_uri)
"set-current-file-uri", VTE_SEQUENCE_HANDLER(vte_sequence_handler_set_current_file_uri)
diff --git a/src/vteseq.c b/src/vteseq.c
index 37d41e1..2383a08 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -31,6 +31,7 @@
#include "vtetc.h"
#define BEL "\007"
+#define ST _VTE_CAP_ST
@@ -1889,9 +1890,10 @@ vte_sequence_handler_scroll_down (VteTerminal *terminal, GValueArray *params)
_vte_terminal_scroll_text (terminal, val);
}
-/* change color in the palette */
+/* Internal helper for changing color in the palette */
static void
-vte_sequence_handler_change_color (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_change_color_internal (VteTerminal *terminal, GValueArray *params,
+ const char *terminator)
{
gchar **pairs, *str = NULL;
GValue *value;
@@ -1928,8 +1930,8 @@ vte_sequence_handler_change_color (VteTerminal *terminal, GValueArray *params)
PangoColor *c = _vte_terminal_get_color(terminal, idx);
g_assert(c != NULL);
g_snprintf (buf, sizeof (buf),
- _VTE_CAP_OSC "4;%u;rgb:%04x/%04x/%04x" BEL, idx,
- c->red, c->green, c->blue);
+ _VTE_CAP_OSC "4;%u;rgb:%04x/%04x/%04x%s",
+ idx, c->red, c->green, c->blue, terminator);
vte_terminal_feed_child (terminal, buf, -1);
}
}
@@ -1943,7 +1945,21 @@ vte_sequence_handler_change_color (VteTerminal *terminal, GValueArray *params)
}
}
-/* Reset the color */
+/* Change color in the palette, BEL terminated */
+static void
+vte_sequence_handler_change_color_bel (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_color_internal (terminal, params, BEL);
+}
+
+/* Change color in the palette, ST terminated */
+static void
+vte_sequence_handler_change_color_st (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_color_internal (terminal, params, ST);
+}
+
+/* Reset color in the palette */
static void
vte_sequence_handler_reset_color (VteTerminal *terminal, GValueArray *params)
{
@@ -3532,7 +3548,8 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
/* Internal helper for setting/querying special colors */
static void
vte_sequence_handler_change_special_color_internal (VteTerminal *terminal, GValueArray *params,
- int index, int index_fallback, int osc)
+ int index, int index_fallback, int osc,
+ const char *terminator)
{
gchar *name = NULL;
GValue *value;
@@ -3558,8 +3575,8 @@ vte_sequence_handler_change_special_color_internal (VteTerminal *terminal, GValu
c = _vte_terminal_get_color(terminal, index_fallback);
g_assert(c != NULL);
g_snprintf (buf, sizeof (buf),
- _VTE_CAP_OSC "%d;rgb:%04x/%04x/%04x" BEL,
- osc, c->red, c->green, c->blue);
+ _VTE_CAP_OSC "%d;rgb:%04x/%04x/%04x%s",
+ osc, c->red, c->green, c->blue, terminator);
vte_terminal_feed_child (terminal, buf, -1);
}
@@ -3567,12 +3584,20 @@ vte_sequence_handler_change_special_color_internal (VteTerminal *terminal, GValu
}
}
-/* Change the default foreground cursor */
+/* Change the default foreground cursor, BEL terminated */
static void
-vte_sequence_handler_change_foreground_color (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_change_foreground_color_bel (VteTerminal *terminal, GValueArray *params)
{
vte_sequence_handler_change_special_color_internal (terminal, params,
- VTE_DEF_FG, -1, 10);
+ VTE_DEF_FG, -1, 10, BEL);
+}
+
+/* Change the default foreground cursor, ST terminated */
+static void
+vte_sequence_handler_change_foreground_color_st (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_DEF_FG, -1, 10, ST);
}
/* Reset the default foreground color */
@@ -3582,12 +3607,20 @@ vte_sequence_handler_reset_foreground_color (VteTerminal *terminal, GValueArray
_vte_terminal_set_color_internal(terminal, VTE_DEF_FG, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
-/* Change the default background cursor */
+/* Change the default background cursor, BEL terminated */
+static void
+vte_sequence_handler_change_background_color_bel (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_DEF_BG, -1, 11, BEL);
+}
+
+/* Change the default background cursor, ST terminated */
static void
-vte_sequence_handler_change_background_color (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_change_background_color_st (VteTerminal *terminal, GValueArray *params)
{
vte_sequence_handler_change_special_color_internal (terminal, params,
- VTE_DEF_BG, -1, 11);
+ VTE_DEF_BG, -1, 11, ST);
}
/* Reset the default background color */
@@ -3597,12 +3630,20 @@ vte_sequence_handler_reset_background_color (VteTerminal *terminal, GValueArray
_vte_terminal_set_color_internal(terminal, VTE_DEF_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
-/* Change the color of the cursor */
+/* Change the color of the cursor, BEL terminated */
+static void
+vte_sequence_handler_change_cursor_color_bel (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_CUR_BG, VTE_DEF_FG, 12, BEL);
+}
+
+/* Change the color of the cursor, ST terminated */
static void
-vte_sequence_handler_change_cursor_color (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_change_cursor_color_st (VteTerminal *terminal, GValueArray *params)
{
vte_sequence_handler_change_special_color_internal (terminal, params,
- VTE_CUR_BG, VTE_DEF_FG, 12);
+ VTE_CUR_BG, VTE_DEF_FG, 12, ST);
}
/* Reset the color of the cursor */
@@ -3612,12 +3653,20 @@ vte_sequence_handler_reset_cursor_color (VteTerminal *terminal, GValueArray *par
_vte_terminal_set_color_internal(terminal, VTE_CUR_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
-/* Change the highlight background color */
+/* Change the highlight background color, BEL terminated */
+static void
+vte_sequence_handler_change_highlight_background_color_bel (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_DEF_HL, VTE_DEF_FG, 17, BEL);
+}
+
+/* Change the highlight background color, ST terminated */
static void
-vte_sequence_handler_change_highlight_background_color (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_change_highlight_background_color_st (VteTerminal *terminal, GValueArray *params)
{
vte_sequence_handler_change_special_color_internal (terminal, params,
- VTE_DEF_HL, VTE_DEF_FG, 17);
+ VTE_DEF_HL, VTE_DEF_FG, 17, ST);
}
/* Reset the highlight background color */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]