Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fea594f

Browse filesBrowse files
committed
Make up and down keys change the current line instead of scrolling in urwid.
1 parent a3eaab6 commit fea594f
Copy full SHA for fea594f

1 file changed

+9-1Lines changed: 9 additions & 1 deletion

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎bpython/urwid.py‎

Copy file name to clipboardExpand all lines: bpython/urwid.py
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,14 @@ def mouse_event(self, *args):
303303
finally:
304304
self._bpy_may_move_cursor = False
305305

306+
class BPythonListBox(urwid.ListBox):
307+
"""Like `urwid.ListBox`, except that it does not eat up and
308+
down keys.
309+
"""
310+
def keypress(self, size, key):
311+
if key not in ["up", "down"]:
312+
return urwid.ListBox.keypress(self, size, key)
313+
return key
306314

307315
class Tooltip(urwid.BoxWidget):
308316

@@ -402,7 +410,7 @@ class URWIDRepl(repl.Repl):
402410
def __init__(self, event_loop, palette, interpreter, config):
403411
repl.Repl.__init__(self, interpreter, config)
404412

405-
self.listbox = urwid.ListBox(urwid.SimpleListWalker([]))
413+
self.listbox = BPythonListBox(urwid.SimpleListWalker([]))
406414

407415
# String is straight from bpython.cli
408416
self.statusbar = Statusbar(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.