-
Notifications
You must be signed in to change notification settings - Fork 218
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
Use simplified keymap for dumb terminal #874
Conversation
Side note: during fixing this I run into some other problems. Most notably current implementation inhibits CRs from dumb terminal which means if you run
The carriage return key will not do anything. The only way to do This problem stems from the line https://github.com/jline/jline3/blob/master/reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java#L639 |
Side note 2: the first test in It should be noted that it will not work on dumb terminals unless the respective bind is added to the dumb terminal bindings, i.e. Doing that binding would be nonsensical since bracketed paste is not turned on for dumb |
public KeyMap<Binding> dumb() { | ||
KeyMap<Binding> dumb = new KeyMap<>(); | ||
bind(dumb, SELF_INSERT, range("^@-^?")); | ||
bind(dumb, ACCEPT_LINE, "\r", "\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would adding "\r\n"
as an additional key binding help with the cr/lf issue on dumb terminals ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would not be deterministic then. How will the system know if to expect only \r
or \r\n
. Remember that there might be no immediate input after the \r
. Consider the following interaction:
Time n
: user inputs something that triggers SELF_INSERT
s, such as "Hello"
Time n+1
: user inputs \r
.
Time n+m
: user inputs a new thing that trigger SELF_INSERT
s, not being \n
, for example, "World"
Surely we cannot wait for a period of unkown m
to determine whether the \r
at n+1
should have triggered ACCEPT_LINE
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider above with this user over a slow connection:
Time n
: process is piped something that triggers SELF_INSERT
s, such as "Hello"
Time n+1
: process is piped \r
Time n+m
: process is piped \n
Waiting for the \n
here would be possible (using a short timeout > m
), but that would mean that a dumb terminal would always wait after a \r
to see if there is a \n
following it. Sometimes it could be available, sometimes not. The bottom line is that it would in any case slow down the process.
@gnodet this PR is actually more important for me. I think it should be quite clean, so maybe you could merge this now and I can continue with the other PR as needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
@hvesalai Unit tests are failing... |
@gnodet yes I know. See note here #874 (comment) I wanted to get your feedback on how to fix this. |
Something like the following should work:
|
@gnodet that fixes it, thank you! Pushed the fix to this PR. |
Fixes #864