gh-118878: Pyrepl: show completions menu below the current line
As proposed in #118878, it feels much more natural to me to display the completions menu below the current line, not above. The main advantage of this is that the UI is less janky, since the current line that is being edited no longer jumps up and down.
This also allows fixing the behaviour of arrow keys when the menu is displayed, described in #119257. The current behaviour is still not great when tab completing in the middle of multiline edit, but it is at least not worse as before AFAIK. I think ultimately this should be solved by separating out the completions menu, like ipython does it, but that seems outside of scope for this PR.
TODO:
- [ ] Tests!
- [ ] Add screencast to demonstrate the new behaviour
Closes #119257. Closes #118878
- Issue: gh-118878
@pablogsal would you mind adding the topic-repl label to this PR?
I am not sure there is enough time to get this in for next beta, but I am happy to work on this further if this is something people are happy with.
CC @lysnikolaou as he was working on something like this for a bugfix
This has the problem that if the cursor is on the last line of the screen, completions are not shown (only when editing a multi-line block)
This has the problem that if the cursor is on the last line of the screen, completions are not shown (only when editing a multi-line block)
@pablogsal was your comment meant on my version of the code or on @lysnikolaou patch proposed in https://github.com/python/cpython/pull/118939#discussion_r1626232966? I can reproduce the issue you describe with his patch but I cannot with the current version of PR.
I merged in main and fixed up a test, and things still seem to be working.