Skip to content
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

Accept CR as an alias for LF to support more platforms #79

Merged
merged 2 commits into from
Sep 1, 2018

Conversation

clue
Copy link
Owner

@clue clue commented Sep 1, 2018

The enter key will usually end the line with a \n (LF) character on most Unix platforms. Common terminals also accept the ^M (CR) key in place of the ^J (LF) key.

By now allowing CR as an alias for LF in this library, we can significantly improve compatibility with this common usage pattern and improve platform support. In particular, some platforms use different TTY settings (icrnl, igncr and family) and depending on these settings emit different EOL characters. This fixes issues where enter was not properly detected when using ext-readline on Mac OS X, Android and others.

Note that Windows technically uses \r\n (CRLF), but this platform is not supported at the moment anyway (#18). I've actually implemented logic to ensure CRLF is only handled as a single line, but reverted this for the PR because this does not seem to be implemented in common terminals either (echo -en "\r\n" | bash -i shows two independent lines and both ^J and ^M show a \n in hd).

Resolves / closes #66
Resolves / closes #77
Supersedes #73

@clue
Copy link
Owner Author

clue commented Sep 1, 2018

For the reference: I've just reverted #73 via #80 now this PR addresses the underlying issues. This means that ext-readline will now be used again on all platforms that support it, including Mac OS X.

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.

enter key not working on Termux (Android) Pressing return in PHPStorm terminal (macOS) doesn't work
1 participant