[Xfce4-commits] [apps/xfce4-terminal] 01/01: Add "Bold is bright" option

noreply at xfce.org noreply at xfce.org
Sat Jan 13 19:30:00 CET 2018


This is an automated email from the git hooks/post-receive script.

f   2   4   0   4       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-terminal.

commit 4d22587223baf6c4dcd69c99174fa86063a106e4
Author: Igor <f2404 at yandex.ru>
Date:   Sat Jan 13 13:25:34 2018 -0500

    Add "Bold is bright" option
    
    Controls whether escape sequences such as \e[1;35m switch to bright colors in
    addition to bold (legacy behavior) or switch to bold and leave the color
    intact (new behavior, required for solarized, base16 and similar modern color
    schemes).
    Removes "Allow bold text" option which is no longer applicable.
    Available since vte 0.51.3.
    
    See bug #14127
---
 terminal/terminal-preferences-dialog.c | 13 ++++++++++++-
 terminal/terminal-preferences.c        | 11 +++++++++++
 terminal/terminal-preferences.glade    | 17 +++++++++++++++++
 terminal/terminal-screen.c             | 10 ++++++++++
 4 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index bdbd509..3a2838c 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -157,6 +157,7 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
                                        "binding-backspace", "binding-delete",
                                        "binding-ambiguous-width", "background-mode",
                                        "background-image-style", "color-background-vary",
+                                       "color-bold-is-bright",
                                        "dropdown-keep-open-default", "dropdown-keep-above",
                                        "dropdown-toggle-focus", "dropdown-status-icon",
                                        "dropdown-move-to-active", "dropdown-always-show-tabs",
@@ -267,11 +268,21 @@ error:
   gtk_widget_hide (GTK_WIDGET (object));
 #endif
 
-#if !VTE_CHECK_VERSION (0, 51, 3)
+#if VTE_CHECK_VERSION (0, 51, 3)
+  /* hide "Allow bold" if vte supports "bold is bright" */
+  object = gtk_builder_get_object (GTK_BUILDER (dialog), "font-allow-bold");
+  terminal_return_if_fail (G_IS_OBJECT (object));
+  gtk_widget_hide (GTK_WIDGET (object));
+#else
   /* hide "Text blinks" if vte doesn't support it */
   object = gtk_builder_get_object (GTK_BUILDER (dialog), "box-text-blink");
   terminal_return_if_fail (G_IS_OBJECT (object));
   gtk_widget_hide (GTK_WIDGET (object));
+
+  /* hide "Bold is bright" if vte doesn't support it */
+  object = gtk_builder_get_object (GTK_BUILDER (dialog), "color-bold-is-bright");
+  terminal_return_if_fail (G_IS_OBJECT (object));
+  gtk_widget_hide (GTK_WIDGET (object));
 #endif
 
   /* run custom command button */
diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index 8d84e56..72ab3f1 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -63,6 +63,7 @@ enum
   PROP_COLOR_BOLD,
   PROP_COLOR_BOLD_USE_DEFAULT,
   PROP_COLOR_PALETTE,
+  PROP_COLOR_BOLD_IS_BRIGHT,
   PROP_COMMAND_LOGIN_SHELL,
   PROP_COMMAND_UPDATE_RECORDS,
   PROP_RUN_CUSTOM_COMMAND,
@@ -529,6 +530,16 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
   /**
+   * TerminalPreferences:color-bold-is-bright:
+   **/
+  preferences_props[PROP_COLOR_BOLD_IS_BRIGHT] =
+      g_param_spec_boolean ("color-bold-is-bright",
+                            NULL,
+                            "ColorBoldIsBright",
+                            TRUE,
+                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
    * TerminalPreferences:tab-activity-color:
    **/
   preferences_props[PROP_TAB_ACTIVITY_COLOR] =
diff --git a/terminal/terminal-preferences.glade b/terminal/terminal-preferences.glade
index 95f6183..7aed608 100644
--- a/terminal/terminal-preferences.glade
+++ b/terminal/terminal-preferences.glade
@@ -2806,6 +2806,23 @@ Opacity setting is not available.</property>
                             <property name="top_attach">1</property>
                           </packing>
                         </child>
+                        <child>
+                          <object class="GtkCheckButton" id="color-bold-is-bright">
+                            <property name="label" translatable="yes">Show bold text in b_right colors</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="tooltip_text" translatable="yes">Enable this option to allow escape sequences such as '\e[1;35m' to switch text to bright colors in addition to bold. If disabled, text color will remain intact.</property>
+                            <property name="halign">start</property>
+                            <property name="use_underline">True</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">2</property>
+                            <property name="width">8</property>
+                          </packing>
+                        </child>
                       </object>
                     </child>
                     <child type="label">
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 1310080..a65f4f0 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -1000,6 +1000,7 @@ terminal_screen_update_colors (TerminalScreen *screen)
   gboolean   vary_bg;
   gdouble    hsv[N_HSV];
   gdouble    sat_min, sat_max;
+  gboolean   bold_is_bright;
 
   g_object_get (screen->preferences,
                 "color-palette", &palette_str,
@@ -1007,6 +1008,7 @@ terminal_screen_update_colors (TerminalScreen *screen)
                 "color-selection-use-default", &selection_use_default,
                 "color-bold-use-default", &bold_use_default,
                 "color-background-vary", &vary_bg,
+                "color-bold-is-bright", &bold_is_bright,
                 NULL);
 
   if (G_LIKELY (palette_str != NULL))
@@ -1105,6 +1107,11 @@ terminal_screen_update_colors (TerminalScreen *screen)
     bold_use_default = !terminal_preferences_get_color (screen->preferences, "color-bold", &bold);
   if (!bold_use_default || has_fg)
     vte_terminal_set_color_bold (VTE_TERMINAL (screen->terminal), bold_use_default ? &fg : &bold);
+
+#if VTE_CHECK_VERSION (0, 51, 3)
+  /* "bold-is-bright" supported since vte 0.51.3 */
+  vte_terminal_set_bold_is_bright (VTE_TERMINAL (screen->terminal), bold_is_bright);
+#endif
 }
 
 
@@ -2581,7 +2588,10 @@ terminal_screen_update_font (TerminalScreen *screen)
   if (G_LIKELY (font_name != NULL))
     {
       font_desc = pango_font_description_from_string (font_name);
+#if !VTE_CHECK_VERSION (0, 51, 3)
+      /* "bold-is-bright" is used since vte 0.51.3 */
       vte_terminal_set_allow_bold (VTE_TERMINAL (screen->terminal), font_allow_bold);
+#endif
       vte_terminal_set_font (VTE_TERMINAL (screen->terminal), font_desc);
       pango_font_description_free (font_desc);
       g_free (font_name);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list