Repository navigation
Refactor input key reading - #712
Conversation
df1cac5 to
2d80784
Compare
st0012
left a comment
There was a problem hiding this comment.
This is a great simplification!
| return UNMATCHED if vi_mode | ||
| end | ||
| input[idx + 1] ? :unmatched : input[idx] ? :matched : :matching | ||
| input[idx + 1] ? UNMATCHED : input[idx] ? MATCHED : MATCHING |
There was a problem hiding this comment.
nit: can we please expand this, my brain isn't good enough to process nested ternary operators 😅
|
One test is failing (fails building native extension while installing io/console). I think it is not related to this change. Passed job Failed job Same commit, same ruby version, different runner image verision. |
(ruby/reline#712) * Add key binding matching status :matching_matched * Simplify read_2nd_character * Add a comment of matching status and EOF * Matching status to a constant * Expand complicated ternary operators to case-when ruby/reline@64deec100b
Simplify input key reading
Depends on #709
Second step of #708
We don't need complex
read_2nd_character_of_key_sequenceandread_escaped_key.This source code commend is partially right (only for ESC keys), but not correct.
Background
With this inputrc file
Input
abis:matchedand also:matching(part ofabcd). In this case, Readline waits for keyseq-timeout milliseconds.Input
abcis:matching(part ofabcd). In this case, Readline waits forever.It's not ESC specific nor 2nd-char specific.
Changes
:matching_matchedforKeyStroke#match_status.matching_matched ? keyseq_timeout : Infinity.