summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2024-10-07 09:37:29 +0900
committergit <svn-admin@ruby-lang.org>2024-10-07 00:37:33 +0000
commit0752fff2152c86caa67d7a0dafcfda3582fbf384 (patch)
tree523cfdb43b54b949b545dc2e499226c1abbc46b6 /lib
parent8f5abcb0c7a81b63f8af9fc53ac7bbb48007974b (diff)
[ruby/reline] Add cursor keys for application keypad mode to default
key bindings (https://github.com/ruby/reline/pull/719) * Add SS3 arrow sequence to default key bindings * Remove wrong KDE arrow sequence https://github.com/ruby/reline/commit/546a42522e
Diffstat (limited to 'lib')
-rw-r--r--lib/reline/io/ansi.rb23
1 files changed, 4 insertions, 19 deletions
diff --git a/lib/reline/io/ansi.rb b/lib/reline/io/ansi.rb
index 82d2ee2371..cf0c1c1b31 100644
--- a/lib/reline/io/ansi.rb
+++ b/lib/reline/io/ansi.rb
@@ -75,7 +75,10 @@ class Reline::ANSI < Reline::IO
def set_default_key_bindings_ansi_cursor(config)
ANSI_CURSOR_KEY_BINDINGS.each do |char, (default_func, modifiers)|
- bindings = [["\e[#{char}", default_func]] # CSI + char
+ bindings = [
+ ["\e[#{char}", default_func], # CSI + char
+ ["\eO#{char}", default_func] # SS3 + char, application cursor key mode
+ ]
if modifiers[:ctrl]
# CSI + ctrl_key_modifier + char
bindings << ["\e[1;5#{char}", modifiers[:ctrl]]
@@ -123,27 +126,9 @@ class Reline::ANSI < Reline::IO
[27, 91, 49, 126] => :ed_move_to_beg, # Home
[27, 91, 52, 126] => :ed_move_to_end, # End
- # KDE
- # Del is 0x08
- [27, 71, 65] => :ed_prev_history, # ↑
- [27, 71, 66] => :ed_next_history, # ↓
- [27, 71, 67] => :ed_next_char, # →
- [27, 71, 68] => :ed_prev_char, # ←
-
# urxvt / exoterm
[27, 91, 55, 126] => :ed_move_to_beg, # Home
[27, 91, 56, 126] => :ed_move_to_end, # End
-
- # GNOME
- [27, 79, 72] => :ed_move_to_beg, # Home
- [27, 79, 70] => :ed_move_to_end, # End
- # Del is 0x08
- # Arrow keys are the same of KDE
-
- [27, 79, 65] => :ed_prev_history, # ↑
- [27, 79, 66] => :ed_next_history, # ↓
- [27, 79, 67] => :ed_next_char, # →
- [27, 79, 68] => :ed_prev_char, # ←
}.each_pair do |key, func|
config.add_default_key_binding_by_keymap(:emacs, key, func)
config.add_default_key_binding_by_keymap(:vi_insert, key, func)