From bbdf05547787b9c26f8341df45be8e439cd29326 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 24 Mar 2010 13:22:37 +0000 Subject: [PATCH] Rather than having people use an ugly value of -1 for infinite scrollback, have it as a separate setting, with all of the extra gubbins involved in making that work neatly. Closes LP #532513 --- terminatorlib/config.py | 1 + terminatorlib/preferences.glade | 34 ++++++++++++++++++++++++++------- terminatorlib/prefseditor.py | 14 ++++++++++++++ terminatorlib/terminal.py | 6 +++++- 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 8812fd18..0e26c313 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -173,6 +173,7 @@ DEFAULTS = { 'scroll_on_keystroke' : True, 'scroll_on_output' : True, 'scrollback_lines' : 500, + 'scrollback_infinite' : False, 'exit_action' : 'close', 'palette' :'#000000000000:#cdcd00000000:#0000cdcd0000:\ #cdcdcdcd0000:#30bf30bfa38e:#a53c212fa53c:\ diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 0d8ae2e2..a68eb149 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -2153,7 +2153,7 @@ True 12 - 4 + 5 2 12 6 @@ -2169,8 +2169,8 @@ 2 - 3 - 4 + 4 + 5 @@ -2186,8 +2186,8 @@ 2 - 2 - 3 + 3 + 4 @@ -2242,7 +2242,7 @@ True 0 - lines <small><b>(Note: for infinite scrollback choose -1)</b></small> + lines True center scrollback_lines_spinbutton @@ -2293,6 +2293,27 @@ GTK_FILL + + + + + + Infinite Scrollback + True + True + False + True + + + + 1 + 2 + 2 + 3 + GTK_FILL + + + 4 @@ -2867,7 +2888,6 @@ 0.20000000000000001 - -1 10000000 1 10 diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 918f5316..3a921d24 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -380,6 +380,9 @@ class PrefsEditor: # Scrollback lines widget = guiget('scrollback_lines_spinbutton') widget.set_value(self.config['scrollback_lines']) + # Scrollback infinite + widget = guiget('scrollback_infinite') + widget.set_active(self.config['scrollback_infinite']) # Scroll on outut widget = guiget('scroll_on_output_checkbutton') widget.set_active(self.config['scroll_on_output']) @@ -519,6 +522,17 @@ class PrefsEditor: self.config['scrollback_lines'] = value self.config.save() + def on_scrollback_infinite_toggled(self, widget): + """Scrollback infiniteness changed""" + spinbutton = self.builder.get_object('scrollback_lines_spinbutton') + value = widget.get_active() + if value == True: + spinbutton.set_sensitive(False) + else: + spinbutton.set_sensitive(True) + self.config['scrollback_infinite'] = value + self.config.save() + def on_scrollbar_position_combobox_changed(self, widget): """Scrollbar position setting changed""" selected = widget.get_active() diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 759565e5..97da9b35 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -629,7 +629,11 @@ for %s (%s)' % (name, urlplugin.__class__.__name__)) except TypeError: err('beep signal unavailable with this version of VTE') - self.vte.set_scrollback_lines(self.config['scrollback_lines']) + if self.config['scrollback_infinite'] == True: + scrollback_lines = -1 + else: + scrollback_lines = self.config['scrollback_lines'] + self.vte.set_scrollback_lines(scrollback_lines) self.vte.set_scroll_on_keystroke(self.config['scroll_on_keystroke']) self.vte.set_scroll_on_output(self.config['scroll_on_output'])