-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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 behaviour in new REPL #118878
Comments
Hi @danielhollas and thanks for opening a bug report! I am also glad you are enjoying Regarding the problem, maybe I am missing something but this is the behaviour also with the old REPL. Check this out: After a single TABAfter the second TABI am missing something? |
Oh wow, you're right 😅 So the jarring thing here is actually the fact that it is jumping up and down, since the menu is now dynamic and will disappear e.g. if you hit backspace. So I think it would make sense to change it and display it below (which is how ipython does it for example). |
We can consider it as a feature for the future |
The main advantage of this is that the behaviour is less janky, since the current line no longer jumps up and down. This also allows fixing the behaviour of arrow keys when the menu is displayed.
The main advantage of this is that the behaviour is less janky, since the current line no longer jumps up and down. This also allows fixing the behaviour of arrow keys when the menu is displayed.
Doing this would also solve a related navigation problem unique to the new REPL: Currently, if you're on a REPL line with completions showing above, typing Home or Ctrl+a will move the cursor to be in front of the first completion result, instead of to the start of the line being edited (or, to put it another way, immediately after the input prompt) where it "should" be. Input otherwise works normally. If you start typing, the completions will disappear and the characters will go to the beginning of the input line. But it's disconcerting to see the cursor placed so far from where it "should" be. |
@ferdnyc Interesting observation! It might be a good idea to open a new issue for the buggy behaviour you observed so we can track it independently. And if you're up for it, it would be great if you could test whether my PR in #118939. If we can show it solved another bug, it could help pushing it through. :-) |
Yeah, honestly I came here to report it (or to find where it was already reported, more likely), then saw this report and realized the change would make it moot.
Good idea. I suppose the other thing to check would be that End / Ctrl+e properly stops at the end of the input line, and doesn't go into the completions. |
Confirmed, both start- and end-of-line keybindings work as expected in the PR's REPL. ...Not sure the initial I know the old REPL technically had the same behavior (Tab in a position without unique completions just silently did nothing, the first time it's typed)... but showing a "[not unique]" message is sort of worse than nothing, in a way. If the display is going to be updated anyway, why not just show the completions? That's how e.g.
|
Though, I will say that I like the handling of partially-unique results better now, as the '[not unique]' response is already streamlined. In Python 3.12, after an >>> sysconfig.g<tab>
# Would automatically complete as far as
>>> sysconfig.get_
# and stop. Then,
>>> sysconfig.get_<tab>
# would do nothing, until a second
>>> sysconfig.get_<tab>
# produced completion results In the PR branch, after the same import, >>> sysconfig.g<tab>
# Updates the input to show,
>>> sysconfig.get_
[not unique]
# And then a second <tab> will show completions immediately But this interaction still feels a bit clunky, in 3.13: >>> import sysconfig
>>> sysconfig.get_<tab>
[not unique]
>>> sysconfig.get_<tab>
(completion results) It's when the REPL has "nothing to add" to your initial input, that it feels like an extra step. |
#126851 (Seen above, in the web interface.) |
I realized I left out a form of completion interaction there — if I type So zsh is consistent with the new REPL, in that on a first The only difference is that zsh optimizes away the case where the user's input can't be extended, because there are only non-unique completions for the characters typed. |
Bug report
Bug description:
I've been playing a bit with the new REPL, it's so awesome! (thanks to @pablogsal and @ambv for the core.py episode 💌 )
I noticed a strange behaviour of the tab completion, whereas upon pressing the tab twice to show available options, the
>>>
prompt jumps down and the options are displayed above it. Please tell me this is a bug and not a feature. 😅After a single TAB
After the second TAB
This is on Fedora 39, built with
./configure --with-readline
, in Terminator terminal.Apologies if I missed something, happy to provide more info.
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: