Skip to content

Fix double-enter issue on Windows#95

Merged
jefferai merged 3 commits intomainfrom
jefferai-fix-double-enter-windows
Oct 5, 2023
Merged

Fix double-enter issue on Windows#95
jefferai merged 3 commits intomainfrom
jefferai-fix-double-enter-windows

Conversation

@jefferai
Copy link
Copy Markdown
Member

@jefferai jefferai commented Oct 5, 2023

Currently, running Read twice on Windows will result in the second call immediately exiting. This is because the first call leaves a \n in the stdin buffer on Windows since Windows sends \r\n on Enter.

This change causes us to loop around again on Windows when we receive an \r so that we can then consume the \n and drain it. This fixes the issue. Note the caveats in the comment, which I'm not worried about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants