Skip to content

Conversation

sandyscott
Copy link

Pressing Enter or Return in a windows client will send two characters. Both will received because aiorepl reads characters one-by-one, both will be a linefeed after universal newline conversion.

This change means the second linefeed is ignored

@sandyscott sandyscott force-pushed the catch_double_newline branch 2 times, most recently from 50d2e6f to 2d01001 Compare October 28, 2022 11:15
Pressing Enter or Return in a windows client will send two characters. both will received, as aiorepl reads characters one-by-one, both will be a linefeed after universal newline conversion.

This change means the second linefeed is ignored
@sandyscott sandyscott force-pushed the catch_double_newline branch from 2d01001 to efb57a0 Compare October 28, 2022 11:18
@dpgeorge
Copy link
Member

I really think that it needs to read from sys.stdin.buffer because that stream is in binary mode (as opposed to sys.stdin which is in text mode and interprets incoming characters as utf-8 encoded).

@sandyscott
Copy link
Author

I was trying to keep this as minimal as possible, because I'm not sure what other effects that change might have, so I'll leave the PR open, and I have a slightly different one at #562 which implements the change to .buffer

Ensure pc (previous character) is not immediately overwritten by the current character
@sandyscott
Copy link
Author

As mentioned on the other PR - switching to binary mode introduces other issues, so I'll leave this open as a simple fix to resolve 1 windows newline being interpreted as 2

@jimmo
Copy link
Member

jimmo commented Nov 9, 2022

Thanks @sandyscott -- Merged in 81c1408 and d6eb5b6.

@jimmo jimmo closed this Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants