summaryrefslogtreecommitdiff
path: root/urwid
diff options
context:
space:
mode:
authorAndrew Dunai <andunai@gmail.com>2018-01-04 13:55:43 +0200
committerGitHub <noreply@github.com>2018-01-04 13:55:43 +0200
commit2496a176c00eab88492f1566f2a89c58be4e15d9 (patch)
tree0972e72532147ad4552b1f69718b334bbe5ed153 /urwid
parent2c63148dc756168e085074bded033dfc0eae1699 (diff)
parentf4204cf0e3b66ff9d215e668d3ef151b33ca878f (diff)
downloadurwid-2496a176c00eab88492f1566f2a89c58be4e15d9.tar.gz
Merge pull request #269 from rndusr/feature/listbox-home-end
Feature/listbox home end
Diffstat (limited to 'urwid')
-rw-r--r--urwid/listbox.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/urwid/listbox.py b/urwid/listbox.py
index 6f92cb6..0a65afa 100644
--- a/urwid/listbox.py
+++ b/urwid/listbox.py
@@ -28,7 +28,7 @@ from urwid.signals import connect_signal
from urwid.monitored_list import MonitoredList, MonitoredFocusList
from urwid.container import WidgetContainerMixin
from urwid.command_map import (CURSOR_UP, CURSOR_DOWN,
- CURSOR_PAGE_UP, CURSOR_PAGE_DOWN)
+ CURSOR_PAGE_UP, CURSOR_PAGE_DOWN, CURSOR_MAX_LEFT, CURSOR_MAX_RIGHT)
class ListWalkerError(Exception):
pass
@@ -1017,8 +1017,23 @@ class ListBox(Widget, WidgetContainerMixin):
if self._command_map[key] == CURSOR_PAGE_DOWN:
return actual_key(self._keypress_page_down((maxcol, maxrow)))
+ if self._command_map[key] == CURSOR_MAX_LEFT:
+ return actual_key(self._keypress_max_left())
+
+ if self._command_map[key] == CURSOR_MAX_RIGHT:
+ return actual_key(self._keypress_max_right())
+
return key
+ def _keypress_max_left(self):
+ self.focus_position = next(iter(self.body.positions()))
+ self.set_focus_valign('top')
+ return True
+
+ def _keypress_max_right(self):
+ self.focus_position = next(iter(self.body.positions(reverse=True)))
+ self.set_focus_valign('bottom')
+ return True
def _keypress_up(self, size):
(maxcol, maxrow) = size