[jhbuild: 59/60] [gui] don't jump scroll when using textview as terminal widget



commit 535bab71c2aaeda89872eee4556fad0a4310f9b1
Author: Frédéric Péters <fpeters 0d be>
Date:   Sat Jun 6 12:56:16 2009 +0200

    [gui] don't jump scroll when using textview as terminal widget
---
 jhbuild/frontends/gtkui.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/jhbuild/frontends/gtkui.py b/jhbuild/frontends/gtkui.py
index 1bc507c..842b3e0 100644
--- a/jhbuild/frontends/gtkui.py
+++ b/jhbuild/frontends/gtkui.py
@@ -190,6 +190,7 @@ class AppWindow(gtk.Window, buildscript.BuildScript):
             self.terminal.set_editable(False)
             self.terminal.set_wrap_mode(gtk.WRAP_CHAR)
         sclwin.add(self.terminal)
+        self.terminal_sclwin = sclwin
 
         self.error_hbox = self.create_error_hbox()
         app_vbox.pack_start(self.error_hbox, fill=False, expand=False)
@@ -521,7 +522,13 @@ class AppWindow(gtk.Window, buildscript.BuildScript):
                     textbuffer.move_mark(mark, textbuffer.get_end_iter())
                 else:
                     mark = textbuffer.create_mark('end', textbuffer.get_end_iter(), False)
-                self.terminal.scroll_to_mark(mark, 0.05, True, 0.0, 1.0)
+
+                if self.terminal_sclwin.get_vadjustment().upper == \
+                        (self.terminal_sclwin.size_request()[1] + 
+                         self.terminal_sclwin.get_vadjustment().get_value()):
+                    # currently at the bottom of the textview, therefore scroll
+                    # automatically
+                    self.terminal.scroll_to_mark(mark, 0.05, True, 0.0, 1.0)
 
                 # See if we should pause the current command
                 if not build_paused and self.is_build_paused():



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