Closed c02y closed 3 years ago
Yeah, we should implement all the common readline stuff. I wonder if we can somehow just re-use readline directly to get everything for free (although there could be issues like https://github.com/inducer/pudb/pull/350).
I would also like that very much. M-backspace, C-b, C-f, M-b, M-f and C-k would already be heaven.
Not opposed. PRs welcome.
I found this python module: urwid_readline. The author creates the class urwid_readline.ReadlineEdit
by subclassing urwid.Edit
. A quick experiment by replacing self.cmdline_edit = urwid.Edit
with self.cmdline_edit = urwi_readline.ReadlineEdit
in debugger.py shows that a lot of the shell shortcuts being asked here (C-b, C-f, C-k, for example) work successfully. There may be some conflicts with pudb's current shortcuts and the shell shortcuts with Meta prefix don't seem to work.
The shorcuts implemented by urwid_readline
Should we use it and fix the conflicts from there, or fix this github issue by implementing the shortcuts ourselves as being done currently?
Edit: Shortcuts with Meta have been working from the start. Turns out on my keyboard Meta is the Alt key, not the "window" key
Either way is fine with me. A particular question that arises is how these Emacs-ish keyboard shortcuts will fit with the (somewhat more vi-ish, maybe?) shortcuts throughout pudb.
Some shortcuts like Ctrl-p already conflict and are disabled in the shell. I think it would be useful to use a library like this. Although I wonder if readline support couldn't be added to urwid itself.
Some shortcuts like Ctrl-p already conflict and are disabled in the shell.
Currently this is not the case. When the focus is in the internal shell, Ctrl-p is cmdline_history_prev
. I have to Ctrl-x to unfocus internal shell then Ctrl-p to get to the preferences menu. I don't know if this is intended or not but it's not a problem.
Anyway, I submitted a PR for this issues using the urwid_readline
library. Adding readline support to urwid itself isn't worth the effort IMO
Either way is fine with me. A particular question that arises is how these Emacs-ish keyboard shortcuts will fit with the (somewhat more vi-ish, maybe?) shortcuts throughout pudb.
Either way is fine with me. A particular question that arises is how these Emacs-ish keyboard shortcuts will fit with the (somewhat more vi-ish, maybe?) shortcuts throughout pudb.
For me this design is ideal, though I am quite suspicious to say, since I've been using vim + the emacish shell shortcuts for a while now.
When I'm using the internal shell to debug such as print value of something, I always miss the shortcuts in my system shell or ipython/bpython such as
Could you please add these shortcuts?