-
Notifications
You must be signed in to change notification settings - Fork 231
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
tab completion in internal shell causes escape mode mess #336
Comments
libedit is known to be quite buggy (it's also included by default on OS X). I believe you can install readline with https://pypi.org/project/gnureadline/ (though I'm not sure how that package works if PuDB needs to be modified to support it). Can you send your diff as a pull request? We would need to test it to make sure that it doesn't break the normal readline environments. |
i'm aware that i could install GNU readline instead, but the whole point of using libedit is to use less bloated components. that way we can have a python 2.7 package that extracts to a mere 22.2 MB. using a static-linked readline just for python would add even more bloat than simply using GNU readline distro-wide ;)
thanks, i will accept your invitation and give it a shot |
when switching to the internal shell and using tab completion, libedit messes up the terminal state, unless it uses the readline initialization routine that the "classic" shell code uses as well. additionally to that, it requires that the console screen is stopped before doing that for the first time. fixes inducer#336
I don't understand this at all--neither the bug nor the patch, sorry. The internal shell is implemented purely in Urwid, with no code path that goes through readline. So introducing readline into that code path seems like a weird thing to do. My read on what's happening is that your Curses library fails to properly set up the terminal to receive the Tab key, resulting in the breakage you observe. Rather than calling into readline to (mostly, by voodoo) fix that bit of terminal state, I feel like there are two options that would be strongly preferable:
|
is that so ? i've seen this snippet and assumed it was used: def cmdline_tab_complete(w, size, key):
from rlcompleter import Completer although i didn't step through it |
That's true--but |
Hmm, now that I've said that: It does import |
admittedly, in sabotage linux we have a quite unusual python setup:
nonetheless, i'm reporting the issue i experienced with pudb 2018-1 here for the record.
when the internal shell is selected, and one switched there using '!', as soon as TAB is pressed for the first time for completion (there needs to be something written, for example "a", which would then be completed to e.g. "abs" or "assert"), escapes are broken and every subsequent keypress is displayed as eg
^CC
or similar, but not recognized as such. makes it impossible to exit the shell via CTRL-X. or use backspace, etc. only way out is to kill pudb.fortunately, i noticed that if i used e.g. the "classic" shell once, then switched to "internal" using preferences, everything behaves as exactly as it should.
this lead me to produce the following patch, which fixes the issue for me.
apparently the readline completer needs to be "initialized" with the code in the patch at least once.
(the self.screen.stop/start is probably not necessary, it's a leftover from my first attempts at fixing)
The text was updated successfully, but these errors were encountered: