-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Reading input byte by byte causes lines with even numbers of characters #16606
Comments
I've found that this PR fixed the issue: #16313 It's planned to be shipped in the next service release for both 1.18 (Stable) and 1.19 (Preview). I'm sorry that it's been taking some time to ship this! But since the bug only started appearing in 1.18, I personally believe it's fine to not hotfix Zig just yet. (Although I do sort of think that using a buffered reader is a great idea, if it's an option. The If you want to test the fix in the meantime, you can find the nightly Canary build here: https://aka.ms/terminal-canary-installer |
Thank you. In Bun i have changed our code to use a buffered reader for all platforms. This makes the It probably makes sense for us to leave that commit in regardless because it improves performance slightly. These are only used for terminal input, where the ReadFile is going to always be blocked on user input ( Maybe I'll revert my change if there are issues consuming stdin from a user program while using the |
Windows Terminal version
1.18.3181.0
Windows build number
10.0.22621.0
Other Software
This bug report is a minimized reproduction of oven-sh/bun#8504.
Steps to reproduce
Demo application "
input.c
"(This program is mimicking the behavior of the Zig standard library function
std.io.Reader().readUntilDelimiterAlloc
, which does a byte by byte read until it hits a specified character)clang input.c
(I used llvm 16.0.4, but I do not think this matters)Run in Windows terminal.
.\a.exe
If you type 0 or an even number of characters, the
\n
byte 10 is not read. only the\r
byte is.If you type an odd number of characters, everything is as normal.
Expected Behavior
I expect all lines to end with
\r\n
, to match the behavior of conhost.exe, ConEmu, Visual Studio Code's Integrated terminal, and also various terminals on Linux/MacOS over an ssh connection.Actual Behavior
my inputs are:
1<return>12<return>123<return><return>
, and then an S pressed by mistake when trying to take a screenshot.The text was updated successfully, but these errors were encountered: