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

Linefeed not accepted as newline #23

Closed
ghost opened this issue Jun 8, 2019 · 3 comments
Closed

Linefeed not accepted as newline #23

ghost opened this issue Jun 8, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented Jun 8, 2019

If I run the example, I can paste CR or CR+LF lines:

$ ./linenoise_example
hello> expr 5 + 2
echo: 'expr 5 + 2'
hello> expr 5 - 2
echo: 'expr 5 - 2'

but if I try to paste LF lines, I get unexpected result:

$ ./linenoise_example
hello> expr 5 + 2expr 5 - 2
echo: 'expr 5 + 2expr 5 - 2'
@ghost
Copy link
Author

ghost commented Jun 9, 2019

Git Bisect reveals this:

15ea795648aa4a4a8aee366914ffe277a5e0c03c is the first bad commit
commit 15ea795648aa4a4a8aee366914ffe277a5e0c03c
Author: Steve Bennett <[email protected]>
Date:   Fri Oct 1 06:07:42 2010 +1000

    Handle control characters in the line

    Only allow tab (^I) to be inserted in the line, not other
    control characters.
    But display any control character as ^x and handle
    the cursor properly.

    Signed-off-by: Steve Bennett <[email protected]>

ghost referenced this issue Jun 9, 2019
Only allow tab (^I) to be inserted in the line, not other
control characters.
But display any control character as ^x and handle
the cursor properly.

Signed-off-by: Steve Bennett <[email protected]>
@ghost
Copy link
Author

ghost commented Jun 9, 2019

Note a fork fixed the issue, see linked commit below. It would be added here:

case '\r': /* enter */

ghost referenced this issue in rain-1/linenoise-mob Jun 9, 2019
In Android's adb shell environment test, click ENTER get line-feed.
@msteveb
Copy link
Owner

msteveb commented Jun 9, 2019

Thanks. That seems reasonable. I don't think there are any downsides. I have added this.

@msteveb msteveb closed this as completed Jun 9, 2019
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

No branches or pull requests

1 participant