python / cpython

The Python programming language
https://www.python.org/
Other
60.78k stars 29.34k forks source link

Tab completion behaviour in new REPL #118878

Open danielhollas opened 1 month ago

danielhollas commented 1 month ago

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 :love_letter: )

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. :sweat_smile:

After a single TAB

image

After the second TAB

image

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

pablogsal commented 1 month ago

Hi @danielhollas and thanks for opening a bug report! I am also glad you are enjoying core.py :)

Regarding the problem, maybe I am missing something but this is the behaviour also with the old REPL. Check this out:

After a single TAB

Screenshot 2024-05-10 at 10 09 55

After the second TAB

Screenshot 2024-05-10 at 10 10 08

I am missing something?

danielhollas commented 1 month ago

Oh wow, you're right :sweat_smile: 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).

pablogsal commented 1 month ago

We can consider it as a feature for the future