Shortcuts for scrolling to the start and end of the scrollback buffer

This commit is contained in:
Kovid Goyal 2016-11-21 20:57:32 +05:30
parent b426210e38
commit 204411e5b8
3 changed files with 12 additions and 2 deletions

View File

@ -122,6 +122,8 @@ class Boss(Thread):
passthrough = func()
if not passthrough:
return
if self.char_grid.scrolled_by:
self.scroll_end()
data = interpret_key_event(key, scancode, mods)
if data:
self.write_to_child(data)
@ -292,4 +294,10 @@ class Boss(Thread):
def scroll_page_down(self):
self.queue_action(self.char_grid.scroll, 'page', False)
def scroll_home(self):
self.queue_action(self.char_grid.scroll, 'full', True)
def scroll_end(self):
self.queue_action(self.char_grid.scroll, 'full', False)
# }}}

View File

@ -219,7 +219,7 @@ class CharGrid:
self.clear_count = 4
def scroll(self, amt, upwards=True):
amt = 1 if amt == 'line' else self.screen.lines - 1 if amt == 'page' else max(0, min(int(amt), self.screen.lines - 1))
amt = {'line': 1, 'page': self.screen.lines - 1, 'full': self.screen.historybuf.count}[amt]
if not upwards:
amt *= -1
y = max(0, min(self.scrolled_by + amt, self.screen.historybuf.count))

View File

@ -341,7 +341,9 @@ map ctrl+shift+c copy_to_clipboard
map ctrl+shift+up scroll_line_up
map ctrl+shift+down scroll_line_down
map ctrl+shift+page_up scroll_page_up
map Ctrl+Shift+page_down scroll_page_down
map ctrl+shift+page_down scroll_page_down
map ctrl+shift+home scroll_home
map ctrl+shift+end scroll_end
'''