-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
v2 console: unblocked WriteFile sets lpNumberOfBytesWritten incorrectly #40
Labels
Product-Conhost
For issues in the Console codebase
Comments
@miniksa @zadjii-msft I assume this is something you'll want to look at? |
This was referenced Dec 17, 2017
Thanks @rprichard, We've addressed the issue recently it's microsoft/vscode#40199. We weren't doing the proper character conversion back to A when the call was not processed immediately. |
It looks like this fix shipped. Thanks for reporting it! |
This was referenced Jan 10, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A console can be frozen/paused if there is text selection (or IIRC if the user hits the Pause key in certain input modes). In that case,
WriteConsole
/WriteFile
calls are blocked until the console is unfrozen.With ASCII output, when a
WriteFile
call successfully completes that had initially been blocked,WriteFile
reports the number of bytes written (vialpNumberOfBytesWritten
) asnNumberOfBytesToWrite * 2
rather thannNumberOfBytesToWrite
. I'd guess that it's reporting the size, in bytes, of the output after a conversion to UTF-16. I expect it to use an unconverted amount.WriteConsoleA
works as expected, as doesWriteFile
in either a legacy console or with the v2 console in Windows 10.0.15063.winpty uses the "Select All" command to synchronize with a stream of output into a console, so programs running winpty hit this
WriteFile
change frequently. In particular, theprint
statement in Python 2.7 can fail, which is causing problems for people:upstream winpty bug: rprichard/winpty#134
Affected Windows versions:
Repro 1 (Python 2.7):
test.py :
Run the script, then press Ctrl-A to select all text before it finishes. Then press ESC. The output looks like this:
Repro 2 (C++11)
Bad output:
Good output:
Edit: update test to reflect that (a)
WriteFile
does the right thing when it isn't blocked by selection, and (b)WriteConsoleA
works in either case.The text was updated successfully, but these errors were encountered: