-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
win32-input-mode: clipboard paste weird escape sequences #17656
Comments
So, the "press" and "release" for each key is expected. The encoding of However, you are requesting Win32 input mode as a client application. That means that all input generated for you from the console subsystem will be in You are getting the bracketed paste sequences We have work on the books to improve this (not translating VT sequences we generate when the application does not need them), but that is largely irrespective of Win32 input mode, and it is low priority because Windows applications already work this way. TL;DR: When you request WIN32IM, you get the same kinds of input records as Console applications. That includes "key press" encodings for VT sequences. 😄 |
But I have only clean text in my clipboard and I want to paste it only. Terminal should enter this text as key presses and nothing else. This problem affects far2l: And I'm not sure if it's far2l's bug or Terminal's bug. |
The win32-input-mode was primarily designed as a I'm also a bit squirmish about working on this space, because I'm still concerned about claiming one of the very scarce terminators ( Footnotes
|
I wouldn't call it private; it's just a protocol for high fidelity Console eventing that terminals on windows can use if they need to represent key make and break sequences.
It is. But Windows console applications don't actually read text, they read true key press and release events, even when they are reading VT. There is a bug today where the key press and release events we synthesize for VT are re-encoded as Win32-input-mode events even when the application has indicated that it wants direct VT input. I'm not talking about our ideal state, just what we have today. What we have today has some gaps because it was not designed to be an application-facing protocol. That's fine; if we want to make it one we can fix the bugs and pursue standardization. |
Thinking about this more: if the shell inside far2l is requesting bracketed paste mode, and far2l is requesting Win32 input mode, then regardless of how the escape sequences are translated I would expect far2l to unencapsulate them. That's what Windows console applications do, when they get them in INPUT_RECORD format (which is the Windows API equivalent.) I'm not closing this and saying we won't fix it, but far2l's translation layer could be better as well. |
I think that this issue is more complex. |
Thanks for finding that! It's fundamentally the same issue. Once one of us is back in the office we'll deduplicate them and migrate all the relevant data over. |
Yes, it was terrible. I fixed it, waiting for pull request merge :) |
Windows Terminal version
1.21.1772.0
Windows build number
10.0.22631.3958
Other Software
standard ssh, Linux
Steps to reproduce
printf "\x1b[?9001h"
to enable win32-input-modeExpected Behavior
;4;20;116;1;0;1_;4;20;116;0;0;1_;18;101;1;0;1_;18;101;0;0;1_;3;31;115;1;0;1_;3;31;115;0;0;1_;4;20;116;1;0;1_;4;20;116;0;0;1_
It's
t
,e
,s
,t
key presses.Actual Behavior
;0;27;1;0;1_;0;91;1;0;1_;0;50;1;0;1_;0;48;1;0;1_;0;48;1;0;1_;0;126;1;0;1_4;20;116;1;0;1_4;20;116;0;0;1_;18;101;1;0;1_;18;101;0;0;1_3;31;115;1;0;1_3;31;115;0;0;1_4;20;116;1;0;1_4;20;116;0;0;1_;0;27;1;0;1_;0;91;1;0;1_;0;50;1;0;1_;0;48;1;0;1_;0;49;1;0;1_;0;126;1;0;1_
Decoded:
As you can see, there are much more key codes. Why?
The text was updated successfully, but these errors were encountered: