Add scrolling with page_up and page_down

This commit is contained in:
Andrew Resch 2009-04-27 17:17:44 +00:00
parent 204f055c7e
commit c267c36b7b
1 changed files with 13 additions and 0 deletions

View File

@ -324,6 +324,19 @@ class Screen(CursesStdIO):
elif c == curses.KEY_END:
self.input_cursor = len(self.input)
# Scrolling through buffer
elif c == curses.KEY_PPAGE:
self.display_lines_offset += self.rows - 3
if self.display_lines_offset > (len(self.lines) - 1 - self.rows - 3):
self.display_lines_offset = len(self.lines) - 1 - self.rows - 3
self.refresh()
elif c == curses.KEY_NPAGE:
self.display_lines_offset -= self.rows - 3
if self.display_lines_offset < 0:
self.display_lines_offset = 0
self.refresh()
# Delete a character in the input string based on cursor position
if c == curses.KEY_BACKSPACE or c == 127:
if self.input and self.input_cursor > 0: