Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable j/k navigation in the RHS sidebar panels #196

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sagittarian
Copy link

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.

@inducer
Copy link
Owner

inducer commented Aug 23, 2016

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.

Works by passing "up" or "down" keypress messages to the Pile widget, so
there is no difference between using j/k and using the up/down arrow
keys.
@sagittarian
Copy link
Author

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.

@inducer
Copy link
Owner

inducer commented Aug 30, 2016

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

@inducer
Copy link
Owner

inducer commented Aug 30, 2016

Forgot to say: Thank you for your contribution--I like the idea!

@brendanator
Copy link

I actually think the original version was better where it didn't jump between windows with j/k. Any chance we could get that?

@craftyguy
Copy link
Contributor

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.

@inducer
Copy link
Owner

inducer commented Feb 12, 2019

Sure, I could see merging a competent implementation of the concept, behind a default-off setting.

@inducer
Copy link
Owner

inducer commented Feb 12, 2019

Thanks for offering!

@craftyguy
Copy link
Contributor

@inducer: Here's my first attempt at it: #328

@aude aude mentioned this pull request Nov 26, 2019
Base automatically changed from master to main March 8, 2021 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants