Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-124096: Enable REPL virtual terminal support on Windows#124119
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
y5c4l3 commented Sep 16, 2024 • edited by bedevere-app bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-app bot
Uh oh!
There was an error while loading. Please reload this page.
ghost commented Sep 16, 2024 • edited by ghost
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by ghost
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
42a48dc to 13bb26fComparepablogsal commented Sep 19, 2024
zooba commented Sep 20, 2024
I'm just testing that indentation works when I paste code? That seems fine. As a side note, my Ctrl+Left and Ctrl+Right shortcuts (skip word) are broken now (possibly ever since the repl went in), and there's way too much ctypes for my liking in here - we should prioritise moving those to |
y5c4l3 commented Sep 20, 2024
It can be fixed by adding two entries in the keymap. I'll later check whether there are other sequences that I missed before and commit as soon. |
3c1502a to 718110fCompareSigned-off-by: y5c4l3 <y5c4l3@proton.me>
To support virtual terminal mode in Windows PYREPL, we need a scanner to read over the supported escaped VT sequences. Signed-off-by: y5c4l3 <y5c4l3@proton.me>
Windows REPL input was using virtual key mode, which does not support terminal escape sequences. This patch calls `SetConsoleMode` properly when initializing and send sequences to enable bracketed-paste modes to support verbatim copy-and-paste. Signed-off-by: y5c4l3 <y5c4l3@proton.me>
y5c4l3 commented Sep 28, 2024
@pablogsal@ambv@zooba
|
cbrnr commented Jan 14, 2025
I just wanted to ask if there is something that I could do to help get this PR merged? It is currently not possible to paste a code snippet containing indentation into the REPL on Windows. I think this is a pretty serious limitation, because many tools (e.g. Visual Studio Code) rely on this mechanism to run selected code portions. I was hoping that this fix would make it into 3.13.1, but unfortunately this was not the case. Currently, this forces people on 3.13 to either disable the new REPL experience or switch to 3.12, both of which are very suboptimal workarounds (because the new REPL is great!). |
pavlovc2 commented Jan 15, 2025
I second the need to get this merged as I am also impacted by the issue. |
wheeheee commented Jan 17, 2025
Would this PR also work for VSCode's integrated terminal? There's a comment here: |
pablogsal commented Jan 22, 2025
We need someone with windows knowledge to validate the PR. Unfortunately I don't have a windows machine or enough knowledge of the platform to validate the correctness. So if you can review the PR or get some windows expert to do we probably can continue landing it |
pablogsal commented Jan 22, 2025
encukou left a comment • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made the change to enable bracketed mode (if VT is supported).
I've tested on Windows 10 on Command Prompt (PS & cmd), VS Code embedded terminal (PS & cmd), and conhost.exe. Bracketed paste works on the first two (there is no confirmation dialog when pasting in multiple lines and the text is not auto-indented; pasting ends the F3 paste mode). On conhost.exe, bracketed paste works as before (dialog appears, text is auto-indented; F3 needs to be ended with another F3).
Ctrl+arrows, PgUp/PgDn, Alt+. still work.
(I found other behaviour that's surprising to me, including a bug, but no unintended changes to the status quo.)
cbrnr commented Jan 23, 2025
I just wanted to thank everyone for helping get this PR merged! You are awesome! ❤️ |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Dustin L. Howett <dustin@howett.net>
wheeheee left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙂 hope this PR gets merged soon
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Misc/NEWS.d/next/Library/2024-09-16-17-03-52.gh-issue-124096.znin0O.rst Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: wheeheee <104880306+wheeheee@users.noreply.github.com>
encukou commented Feb 5, 2025
I plan to take some time this or next week to write the tests. |
The patch decorator was being called even on the skipped test.
encukou commented Feb 17, 2025
I added |
encukou commented Feb 20, 2025
I'll merge next week if there are no objections. |
a65366e into python:mainUh oh!
There was an error while loading. Please reload this page.
…honGH-124119) To support virtual terminal mode in Windows PYREPL, we need a scanner to read over the supported escaped VT sequences. Windows REPL input was using virtual key mode, which does not support terminal escape sequences. This patch calls `SetConsoleMode` properly when initializing and send sequences to enable bracketed-paste modes to support verbatim copy-and-paste. (cherry picked from commit a65366e) Co-authored-by: Y5 <124019959+y5c4l3@users.noreply.github.com> Signed-off-by: y5c4l3 <y5c4l3@proton.me> Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Dustin L. Howett <dustin@howett.net> Co-authored-by: wheeheee <104880306+wheeheee@users.noreply.github.com>
GH-133457 is a backport of this pull request to the 3.13 branch. |
…-124119) (GH-133457) To support virtual terminal mode in Windows PYREPL, we need a scanner to read over the supported escaped VT sequences. Windows REPL input was using virtual key mode, which does not support terminal escape sequences. This patch calls `SetConsoleMode` properly when initializing and send sequences to enable bracketed-paste modes to support verbatim copy-and-paste. (cherry picked from commit a65366e) Co-authored-by: Y5 <124019959+y5c4l3@users.noreply.github.com> Signed-off-by: y5c4l3 <y5c4l3@proton.me> Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Dustin L. Howett <dustin@howett.net> Co-authored-by: wheeheee <104880306+wheeheee@users.noreply.github.com>
tpnga95 commented Aug 28, 2025
I still get that error even using the latest version 3.13.7. Is there any solution? |
encukou commented Aug 28, 2025
What's your setup? Are you using Windows Terminal? A workaround is using “paste mode” (the F3 key) for pasting text to the console. |

Issue: #124096