-
Notifications
You must be signed in to change notification settings - Fork 93
Add key binding for Delete (save Insert, PgUp, PgDn for later) #434
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
Conversation
|
Can confirm that this fixes the following issue I have with the delete key:
My situation:
Edit: can confirm that this fixes the other keys mentioned (pgup/pgdn) as well. |
|
Could you add tests? |
I'm not used to Test::Unit, only rspec, but I'll see what I can do. I think the tricky part is that in order to test these key bindings that works regardless of the current terminfo of whoever is running the test, I would need to stub out |
|
I spent some time on this today, but I got stuck for a while due to ncurses library not even getting loaded, so (It's because of some Linux distros using linker scripts in .so files and the workaround got reverted because there is a fix to fiddle itself now, but ruby still needs to sync / pull in the latest Anyways, so after stumbling on that for a while, I noticed that there are exactly 0 tests for |
|
Ok, I think I know how to best test this now. At first I thought I would add a parameter to But that's overkill anyways, so next I thought I would add some tests to test_key_stroke.rb, using simple tests just like That would work, but it's still overkill because it tests both 1. "did the correct key bindings get put into the config?", and 2. "did expand turn them into the proper symbol keys?", and we only want to test 1 not 2 (we already have key stroke tests). So I think the right approach is to simply add a test_ansi.rb and in there add tests for the ANSI So yeah, this is gonna be pretty simple. My only question is what to do about the fact that the key bindings are different depending on whether So that is where I am stuck now, but I'll take another look maybe next weekend and it's still gonna be easy, at least once I figure out how to make it so I can test both the with and without terminfo scenarios. |
|
@nobu I added tests! |
|
@nobu do you need anything else for this PR? |
|
I can also confirm that it fixes the fn+delete key for me. And the solution seems to be well-covered by tests. |
|
@sshock I would like to run CI. Can you push again? |
|
@sshock I could confirm this patch works well on:
If TERM is ANSI or VT100 or VT102, it does not work well. As hasumikin commented at #458 (comment), we don't merge any PR (except emergency ones) before releasing reline 0.3.2 to keep the next Ruby 3.2 stable. I understand the seriousness of this issue. I hope to include it in the next release. @hasumikin |
adcd710 to
603eace
Compare
|
Really sorry for the late confirmation.
|
|
Hello! It looks like this patch is causing flaky tests in ruby/ruby with failures that look like the following: Here are some example failing builds:
Could you take a look at it? |
Maybe it doesn't like the |
This fixes the delete key (delete on pc keyboard; fn+delete on mac keyboard) to work on macOS in Terminal and iTerm2.
It also fixes the insert, pgup, and pgdn keys to no longer spew out ugly escape codes.(do these later in a separate MR)Helps with issue ruby/irb#330.