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 on Windows: add Ctrl+← and Ctrl+→ word-skipping and other keybindings #128388

Open
paulie4 opened this issue Jan 1, 2025 · 4 comments
Labels
OS-windows topic-repl Related to the interactive shell type-feature A feature request or enhancement

Comments

@paulie4
Copy link
Contributor

paulie4 commented Jan 1, 2025

Feature or enhancement

Proposal:

Currently, _pyrepl/windows_console.py is very limited compared to _pyrepl/unix_console.py, for example, it doesn't support the Ctrl+ and Ctrl+ word-skipping keybindings (see also #119248) nor any of the keybindings that use meta (i.e. Alt), e.g. to kill-word or backward-kill-word.

This is extra-annoying given the fact that the previous Python REPL did support Ctrl+andCtrl+→` word-skipping keybindings in Windows, i.e. before pyrepl was used for Python 3.13.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

@paulie4 paulie4 added the type-feature A feature request or enhancement label Jan 1, 2025
@hugovk hugovk added OS-windows topic-repl Related to the interactive shell labels Jan 1, 2025
@zooba
Copy link
Member

zooba commented Jan 1, 2025

Considering this is one of the reasons that I disable the new REPL entirely, it might be justifiable to treat this as a bug?

I don't particularly mind not having the new REPL, which is why I haven't spent the time to try and fix it. But you could argue that it's not fit for purpose if I'm just turning the whole thing off.

encukou pushed a commit that referenced this issue Jan 10, 2025
…-128389)

Fix `Lib/_pyrepl/windows_console.py` to support more keybindings, like the
`Ctrl`+`←` and `Ctrl`+`→` word-skipping keybindings and those with meta (i.e. Alt),
e.g. to `kill-word` or `backward-kill-word`.

Specifics: if Ctrl is pressed, emit "ctrl left" and "ctrl right" instead of just "left" or
"right," and if Meta/Alt is pressed, emit the special key code for meta before
emitting the other key that was pressed.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
@encukou
Copy link
Member

encukou commented Jan 10, 2025

To me this sounds very much like a new feature.
Do you want to ask the RM for an exception to backport it?

@paulie4
Copy link
Contributor Author

paulie4 commented Jan 10, 2025

I'm sure there are many of us that use Ctrl+Backspace in Windows and have come to expect that to delete a word, and since that used to work in Python REPL but no longer does, that's why it is a regression and therefore feels like it should be considered a bug. In fact, I can't think of a single application in Windows that I use that doesn't support Ctrl+Backspace to delete a word (besides the new Python 3.13+ REPL).

Yes, please! It would be great if this fix goes into both Python 3.14.x and 3.13.x. BTW, the single code file that was edited in #128389 has the exact same code in the main and 3.13 branches, so backporting should be very easy.

@zooba
Copy link
Member

zooba commented Jan 10, 2025

I agree it's a regression. When disabling the feature adds functionality, it's hard to call that functionality "new".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS-windows topic-repl Related to the interactive shell type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants