mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-20 11:35:49 +00:00
Made popup windows scrollable with page up/down and home/end
This commit is contained in:
parent
6326902287
commit
b5cfbbcdec
1 changed files with 9 additions and 0 deletions
|
@ -123,11 +123,20 @@ class Popup:
|
|||
self._lines = []
|
||||
|
||||
def handle_read(self, c):
|
||||
p_off = self.height - 3
|
||||
if c == curses.KEY_UP:
|
||||
self.lineoff = max(0,self.lineoff -1)
|
||||
elif c == curses.KEY_PPAGE:
|
||||
self.lineoff = max(0,self.lineoff - p_off)
|
||||
elif c == curses.KEY_HOME:
|
||||
self.lineoff = 0
|
||||
elif c == curses.KEY_DOWN:
|
||||
if len(self._lines)-self.lineoff > (self.height-2):
|
||||
self.lineoff += 1
|
||||
elif c == curses.KEY_NPAGE:
|
||||
self.lineoff = min(len(self._lines) - self.height+2, self.lineoff + p_off)
|
||||
elif c == curses.KEY_END:
|
||||
self.lineoff = len(self._lines) - self.height+2
|
||||
|
||||
elif c == curses.KEY_ENTER or c == 10 or c == 27: # close on enter/esc
|
||||
if self.close_cb:
|
||||
|
|
Loading…
Add table
Reference in a new issue