Merge feature from nanikata. Closes LP#332267
This commit is contained in:
parent
eababae92a
commit
d271137675
@ -130,6 +130,12 @@ DEFAULTS = {
|
||||
'paste' : '<Shift><Control>v',
|
||||
'toggle_scrollbar' : '<Shift><Control>s',
|
||||
'search' : '<Shift><Control>f',
|
||||
'page_up' : '',
|
||||
'page_down' : '',
|
||||
'page_up_half' : '',
|
||||
'page_down_half' : '',
|
||||
'line_up' : '',
|
||||
'line_down' : '',
|
||||
'close_window' : '<Shift><Control>q',
|
||||
'resize_up' : '<Shift><Control>Up',
|
||||
'resize_down' : '<Shift><Control>Down',
|
||||
|
@ -101,6 +101,12 @@ class PrefsEditor:
|
||||
'paste' : 'Paste clipboard',
|
||||
'toggle_scrollbar' : 'Show/Hide the scrollbar',
|
||||
'search' : 'Search terminal scrollback',
|
||||
'page_up' : 'Scroll upwards one page',
|
||||
'page_down' : 'Scroll downwards one page',
|
||||
'page_up_half' : 'Scroll upwards half a page',
|
||||
'page_down_half' : 'Scroll downwards half a page',
|
||||
'line_up' : 'Scroll upwards one line',
|
||||
'line_down' : 'Scroll downwards one line',
|
||||
'close_window' : 'Close window',
|
||||
'resize_up' : 'Resize the terminal up',
|
||||
'resize_down' : 'Resize the terminal down',
|
||||
|
@ -1503,6 +1503,23 @@ class Terminal(gtk.VBox):
|
||||
if layout.has_key('title') and layout['title'] != '':
|
||||
self.titlebar.set_custom_string(layout['title'])
|
||||
|
||||
def scroll_by_page(self, pages):
|
||||
"""Scroll up or down in pages"""
|
||||
amount = pages * self.vte.get_adjustment().get_page_increment()
|
||||
self.scroll_by(int(amount))
|
||||
|
||||
def scroll_by_line(self, lines):
|
||||
"""Scroll up or down in lines"""
|
||||
amount = lines * self.vte.get_adjustment().get_step_increment()
|
||||
self.scroll_by(int(amount))
|
||||
|
||||
def scroll_by(self, amount):
|
||||
"""Scroll up or down by an amount of lines"""
|
||||
adjustment = self.vte.get_adjustment()
|
||||
bottom = adjustment.upper - adjustment.page_size
|
||||
value = adjustment.get_value() + amount
|
||||
adjustment.set_value(min(value, bottom))
|
||||
|
||||
# There now begins a great list of keyboard event handlers
|
||||
def key_zoom_in(self):
|
||||
self.zoom_in()
|
||||
@ -1718,6 +1735,24 @@ class Terminal(gtk.VBox):
|
||||
dialog.destroy()
|
||||
return
|
||||
|
||||
def key_page_up(self):
|
||||
self.scroll_by_page(-1)
|
||||
|
||||
def key_page_down(self):
|
||||
self.scroll_by_page(1)
|
||||
|
||||
def key_page_up_half(self):
|
||||
self.scroll_by_page(-0.5)
|
||||
|
||||
def key_page_down_half(self):
|
||||
self.scroll_by_page(0.5)
|
||||
|
||||
def key_line_up(self):
|
||||
self.scroll_by_line(-1)
|
||||
|
||||
def key_line_down(self):
|
||||
self.scroll_by_line(1)
|
||||
|
||||
# End key events
|
||||
|
||||
gobject.type_register(Terminal)
|
||||
|
Loading…
Reference in New Issue
Block a user