Skip to content
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

pyrepl: Cursor behaviour during tab-completion #119257

Open
danielhollas opened this issue May 20, 2024 · 3 comments · May be fixed by #118939
Open

pyrepl: Cursor behaviour during tab-completion #119257

danielhollas opened this issue May 20, 2024 · 3 comments · May be fixed by #118939
Labels
topic-repl Related to the interactive shell

Comments

@danielhollas
Copy link
Contributor

Pressing the Left arrow after the completions are shown moves the cursor three positions to the left.

It turns out reader.pos2xy uses reader.screen and reader.screeninfo to compute the position in the screen. Both of these include the two lines with completions. However, reader.pos and reader.buffer only include the things actually typed by the user (i.e. the third line datetime.). This leads to the new cursor position calculation being faulty. We'll have to think more about how to fix this.

Originally posted by @lysnikolaou in #118877 (comment)

@danielhollas
Copy link
Contributor Author

@lysnikolaou I've taken the liberty of creating the issue for your observation in #118877, I hope that is okay.

I believe I have a fix for this in #118939, in case you want to take a look. Thanks!

@ambv ambv added the topic-repl Related to the interactive shell label May 21, 2024
@cfbolz
Copy link
Contributor

cfbolz commented Aug 24, 2024

I just hit this bug too, here's a recording (just before the cursor jumped, I pressed left arrow):
asciicast

@danielhollas
Copy link
Contributor Author

@cfbolz thanks for confirming the issue! It would be great if you could test if #118939 solves the problem for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-repl Related to the interactive shell
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants