-
Notifications
You must be signed in to change notification settings - Fork 88
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
Support key stroke in trap key #332
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ebc3e0f
Reline::Key supports the comparison with Integer
aycabta 5f1141b
Support oneshot key bindings config for key_trap of dialog callbacks
aycabta 1fc3276
Add Reline::Key#== as an alias to Reline::Key#match?
aycabta cf78a38
Support for key bindings result Symbol in Reline::Key
aycabta 731103f
Allow Reline::KeyStroke to compare raw and meta-key processed key seq…
aycabta 8fca5f6
Use combined_key if it exists when comparing Reline::Key and Integer
aycabta 67f1d8d
Use sort.last instead of sort.reverse.first
aycabta 7e56c8a
No need to use max_by when array.size == 1
aycabta b0207fa
Support multiple trap_key
aycabta 92518d1
Cut out read_2nd_character_of_key_sequence
aycabta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could we achieve this another way? Redefining
==
on integer (even in a refinement) will clear BOP_EQ for integers, making all comparisons slower.ie. This optimization in MRI will no longer work https://github.com/ruby/ruby/blob/master/vm_insnhelper.c#L1986-L1987
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.
Terminal control software often spends more than 99% of its processing time displaying characters to the terminal. Do you have any performance measurement results that show that key processing is the bottleneck and should be improved?
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.
Sorry. The issue isn't in reline's processing, but that this will make Ruby's integer comparisons slower globally. All code will be slower, not just reline.
Here's a hacky demonstration benchmark on latest Ruby trunk:
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.
Thanks for the concise and clear explanation. I now understand the problem. It looks like
binding.irb
is going to cause serious problems in Rails applications.Please wait a bit while we work on it.
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.
#347
I did it. I think this problem was pretty bad. I'm glad I could handle it. Thanks again.
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.
Change looks great! Thank you for looking into this.