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
Implement changing editing mode #681
Conversation
5d55556
to
2a75980
Compare
Since both mappings are currently used for other operations, this feels like a breaking change. |
The original key mapping is different from Readline, so I believe few people use it. |
Just for information, GNU Bash source code comment also says it's confusing. /* In Bash, the user can switch editing modes with "set -o [vi emacs]",
so it is not necessary to allow C-M-j for context switching. Turn
off this occasionally confusing behaviour. */
...
if (func == rl_vi_editing_mode)
rl_unbind_key_in_map (CTRL('J'), emacs_meta_keymap);
...
if (func == rl_vi_editing_mode)
rl_unbind_key_in_map (CTRL('M'), emacs_meta_keymap);
...
if (func == rl_emacs_editing_mode)
rl_unbind_key_in_map (CTRL('E'), vi_movement_keymap); |
2a75980
to
92ef148
Compare
@@ -1436,4 +1436,9 @@ def test_unix_line_discard | |||
input_keys("\C-f\C-u", false) | |||
assert_line_around_cursor('', '') | |||
end | |||
|
|||
def test_vi_editing_mode | |||
@line_editor.__send__(:vi_editing_mode, nil) |
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.
When key binding is set, key.char
is passed as symbol
to LineEditor#update
.
I can't seem to test it properly with input_keys
. If you have a better way to do this, please let me know.
I implemented Readline’s emacs-editing-mode (C-e) and vi-editing-mode (M-C-j, M-C-m) to switch editing modes. The keymap was aligned with Readline's behavior. But
M-C-m
was used in the yamatanooroti tests, so I decided not to map it.