pudb
pudb copied to clipboard
Enable j/k navigation in the RHS sidebar panels
I found it very annoying to have to move my hand to the arrow keys to navigate in the sidebar panels. This patch make j/k work for down/up like in the source panel.
Thanks for the patch! I see what you're getting at, but I find the resulting user experience a bit confusing. The cursor keys navigate within and across the RHS panels, but j/k only navigate within the panels. That's a tad weird, and I can see how it would confuse users.
I see what you're saying. I reworked it so that j/k in the sidebar area work the same as the up and down arrows.
Crashes:
Traceback (most recent call last):
File "pudb/__init__.py", line 80, in runscript
dbg._runscript(mainpyfile)
File "pudb/debugger.py", line 419, in _runscript
self.run(statement, globals=globals_, locals=locals_)
File "/usr/lib/python2.7/bdb.py", line 400, in run
exec cmd in globals, locals
File "<string>", line 1, in <module>
File "debug_me.py", line 1, in <module>
class MyClass(object):
File "debug_me.py", line 1, in <module>
class MyClass(object):
File "/usr/lib/python2.7/bdb.py", line 49, in trace_dispatch
return self.dispatch_line(frame)
File "pudb/debugger.py", line 173, in dispatch_line
self.user_line(frame)
File "pudb/debugger.py", line 371, in user_line
self.interaction(frame)
File "pudb/debugger.py", line 339, in interaction
show_exc_dialog=show_exc_dialog)
File "pudb/debugger.py", line 2092, in call_with_ui
return f(*args, **kwargs)
File "pudb/debugger.py", line 2309, in interaction
self.event_loop()
File "pudb/debugger.py", line 2275, in event_loop
toplevel.keypress(self.size, k)
File "pudb/ui_tools.py", line 96, in keypress
result = self._w.keypress(size, key)
File "/home/andreas/pool/local/lib/python2.7/site-packages/urwid/container.py", line 1128, in keypress
return self.body.keypress( (maxcol, remaining), key )
File "/home/andreas/pool/local/lib/python2.7/site-packages/urwid/container.py", line 2269, in keypress
key = w.keypress((mc,) + size[1:], key)
File "pudb/ui_tools.py", line 96, in keypress
result = self._w.keypress(size, key)
File "/home/andreas/pool/local/lib/python2.7/site-packages/urwid/container.py", line 1587, in keypress
key = self.focus.keypress(tsize, key)
File "/home/andreas/pool/local/lib/python2.7/site-packages/urwid/container.py", line 1587, in keypress
key = self.focus.keypress(tsize, key)
File "pudb/ui_tools.py", line 101, in keypress
return handler(self, size, key)
File "pudb/debugger.py", line 720, in rhs_down
self.rhs_col.keypress(size, "down")
File "/home/andreas/pool/local/lib/python2.7/site-packages/urwid/container.py", line 1587, in keypress
key = self.focus.keypress(tsize, key)
File "/home/andreas/pool/local/lib/python2.7/site-packages/urwid/container.py", line 1587, in keypress
key = self.focus.keypress(tsize, key)
File "pudb/ui_tools.py", line 96, in keypress
result = self._w.keypress(size, key)
File "/home/andreas/pool/local/lib/python2.7/site-packages/urwid/listbox.py", line 1001, in keypress
return actual_key(self._keypress_down((maxcol, maxrow)))
File "/home/andreas/pool/local/lib/python2.7/site-packages/urwid/listbox.py", line 1136, in _keypress_down
row_offset-rows)
File "/home/andreas/pool/local/lib/python2.7/site-packages/urwid/listbox.py", line 782, in shift_focus
raise ListBoxError, "Invalid offset_inset: %r, only %r rows in target!" %(offset_inset, tgt_rows)
ListBoxError: Invalid offset_inset: -1, only 1 rows in target!
To reproduce:
-
./try-the-debugger.sh
- Cursor Right
-
j
,j
Forgot to say: Thank you for your contribution--I like the idea!
I actually think the original version was better where it didn't jump between windows with j/k. Any chance we could get that?
At the very least, this could be configured via a setting option? I have no physical arrow keys on my keyboards (vim binding all the things!), so having the ability to scroll within a sidebar menu with j/k would be awesome.
@inducer: if you're willing to merge this functionality (e.g. enabled with a setting that is disabled by default so as not to confuse users out of the box), I would be willing to adopt this MR and try to implement it.
Sure, I could see merging a competent implementation of the concept, behind a default-off setting.
Thanks for offering!
@inducer: Here's my first attempt at it: #328