Fix scrollbar position on current terminals when changed in prefs

This commit is contained in:
Stephen Boddy 2015-12-02 21:12:52 +01:00
parent 2e82e24fee
commit 6ac67768e7
1 changed files with 10 additions and 23 deletions

View File

@ -86,7 +86,6 @@ class Terminal(gtk.VBox):
vte = None vte = None
terminalbox = None terminalbox = None
scrollbar = None scrollbar = None
scrollbar_position = None
titlebar = None titlebar = None
searchbar = None searchbar = None
@ -244,19 +243,9 @@ class Terminal(gtk.VBox):
terminalbox = gtk.HBox() terminalbox = gtk.HBox()
self.scrollbar = gtk.VScrollbar(self.vte.get_adjustment()) self.scrollbar = gtk.VScrollbar(self.vte.get_adjustment())
self.scrollbar.set_no_show_all(True)
self.scrollbar_position = self.config['scrollbar_position']
if self.scrollbar_position not in ('hidden', 'disabled'): terminalbox.pack_start(self.vte, True, True, 0)
self.scrollbar.show() terminalbox.pack_start(self.scrollbar, False, True, 0)
if self.scrollbar_position == 'left':
func = terminalbox.pack_end
else:
func = terminalbox.pack_start
func(self.vte)
func(self.scrollbar, False)
terminalbox.show_all() terminalbox.show_all()
return(terminalbox) return(terminalbox)
@ -792,16 +781,14 @@ class Terminal(gtk.VBox):
self.vte.set_scroll_on_keystroke(self.config['scroll_on_keystroke']) self.vte.set_scroll_on_keystroke(self.config['scroll_on_keystroke'])
self.vte.set_scroll_on_output(self.config['scroll_on_output']) self.vte.set_scroll_on_output(self.config['scroll_on_output'])
if self.scrollbar_position != self.config['scrollbar_position']: if self.config['scrollbar_position'] in ['disabled', 'hidden']:
self.scrollbar_position = self.config['scrollbar_position'] self.scrollbar.hide()
if self.config['scrollbar_position'] in ['disabled', 'hidden']: else:
self.scrollbar.hide() self.scrollbar.show()
else: if self.config['scrollbar_position'] == 'left':
self.scrollbar.show() self.terminalbox.reorder_child(self.scrollbar, 0)
if self.config['scrollbar_position'] == 'left': elif self.config['scrollbar_position'] == 'right':
self.reorder_child(self.scrollbar, 0) self.terminalbox.reorder_child(self.vte, 0)
elif self.config['scrollbar_position'] == 'right':
self.reorder_child(self.vte, 0)
if hasattr(self.vte, 'set_alternate_screen_scroll'): if hasattr(self.vte, 'set_alternate_screen_scroll'):
self.vte.set_alternate_screen_scroll( self.vte.set_alternate_screen_scroll(