[PATCH] Added support for unlimited scrollback in terminal output.

Stefano Angeleri weltall2 at gmail.com
Sun Feb 24 13:46:11 CET 2013


---
 terminal/terminal-preferences-dialog.c |  6 +++---
 terminal/terminal-preferences.c        | 11 +++++++++++
 terminal/terminal-preferences.glade    | 19 ++++++++++++++++++-
 terminal/terminal-screen.c             | 10 ++++++++--
 4 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index 9be0826..524e584 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -137,9 +137,9 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
   const gchar      *props_active[] = { "title-mode", "command-login-shell",
                                        "command-update-records", "scrolling-single-line",
                                        "scrolling-on-output", "scrolling-on-keystroke",
-                                       "scrolling-bar", "font-allow-bold",
-                                       "misc-menubar-default", "misc-toolbar-default",
-                                       "misc-borders-default",
+                                       "scrolling-bar", "scrolling-unlimited",
+                                       "font-allow-bold", "misc-menubar-default",
+                                       "misc-toolbar-default", "misc-borders-default",
                                        "shortcuts-no-mnemonics", "shortcuts-no-menukey",
                                        "binding-backspace", "binding-delete",
                                        "background-mode", "background-image-style",
diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index dcb223b..7f9abb7 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -95,6 +95,7 @@ enum
   PROP_SCROLLING_ON_OUTPUT,
   PROP_SCROLLING_ON_KEYSTROKE,
   PROP_SCROLLING_SINGLE_LINE,
+  PROP_SCROLLING_UNLIMITED,
   PROP_SHORTCUTS_NO_MENUKEY,
   PROP_SHORTCUTS_NO_MNEMONICS,
   PROP_TITLE_INITIAL,
@@ -816,6 +817,16 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
                          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
   /**
+   * TerminalPreferences:scrolling-unlimited:
+   **/
+  preferences_props[PROP_SCROLLING_UNLIMITED] =
+      g_param_spec_boolean ("scrolling-unlimited",
+                            NULL,
+                            "ScrollingUnlimited",
+                            FALSE,
+                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
    * TerminalPreferences:scrolling-on-output:
    **/
   preferences_props[PROP_SCROLLING_ON_OUTPUT] =
diff --git a/terminal/terminal-preferences.glade b/terminal/terminal-preferences.glade
index a4a9284..63ade20 100644
--- a/terminal/terminal-preferences.glade
+++ b/terminal/terminal-preferences.glade
@@ -506,7 +506,7 @@
                               <object class="GtkTable" id="table2">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="n_rows">2</property>
+                                <property name="n_rows">3</property>
                                 <property name="n_columns">2</property>
                                 <property name="column_spacing">12</property>
                                 <property name="row_spacing">6</property>
@@ -583,6 +583,23 @@
                                 <property name="position">2</property>
                               </packing>
                             </child>
+                            <child>
+                              <object class="GtkCheckButton" id="scrolling-unlimited">
+                                <property name="label" translatable="yes">Unli_mited scrollback</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="tooltip_text" translatable="yes">This option controls whether the terminal will have no limits on scroll back.</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">3</property>
+                              </packing>
+                            </child>
                           </object>
                         </child>
                       </object>
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 8831573..b9a6abf 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -502,6 +502,8 @@ terminal_screen_preferences_changed (TerminalPreferences *preferences,
     terminal_screen_update_scrolling_bar (screen);
   else if (strcmp ("scrolling-lines", name) == 0)
     terminal_screen_update_scrolling_lines (screen);
+  else if (strcmp ("scrolling-unlimited", name) == 0)
+    terminal_screen_update_scrolling_lines (screen);
   else if (strcmp ("scrolling-on-output", name) == 0)
     terminal_screen_update_scrolling_on_output (screen);
   else if (strcmp ("scrolling-on-keystroke", name) == 0)
@@ -1116,9 +1118,13 @@ terminal_screen_update_scrolling_bar (TerminalScreen *screen)
 static void
 terminal_screen_update_scrolling_lines (TerminalScreen *screen)
 {
-  guint lines;
+  glong lines;
+  gboolean unlimited;
+  g_object_get (G_OBJECT (screen->preferences), "scrolling-unlimited", &unlimited, NULL);
   g_object_get (G_OBJECT (screen->preferences), "scrolling-lines", &lines, NULL);
-  vte_terminal_set_scrollback_lines (VTE_TERMINAL (screen->terminal), lines);
+  
+  /* check if the unlimited option is activated, in that case override the scrolling lines */
+  vte_terminal_set_scrollback_lines (VTE_TERMINAL (screen->terminal), unlimited ? -1 : lines);
 }
 
 
-- 
1.8.1.4



More information about the Xfce4-dev mailing list