aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reline/ansi.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-01 00:34:38 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-01 00:41:17 +0900
commit552c42f51f75eeeaa5a46e2df28fd5dab77261da (patch)
treeaf77c385949813832e8b8d89ee8cf422c04ddbd8 /lib/reline/ansi.rb
parent8fc552adee76ec324a219ba6b19fa2e39a1e014e (diff)
downloadruby-552c42f51f75eeeaa5a46e2df28fd5dab77261da.tar.gz
Seprate raw keystroke config for each platforms
Diffstat (limited to 'lib/reline/ansi.rb')
-rw-r--r--lib/reline/ansi.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb
index 1ead89b8ff..e6b3344285 100644
--- a/lib/reline/ansi.rb
+++ b/lib/reline/ansi.rb
@@ -1,4 +1,16 @@
class Reline::ANSI
+ RAW_KEYSTROKE_CONFIG = {
+ key_mapping: {
+ [27, 91, 65] => :ed_prev_history, # ↑
+ [27, 91, 66] => :ed_next_history, # ↓
+ [27, 91, 67] => :ed_next_char, # →
+ [27, 91, 68] => :ed_prev_char, # ←
+ [27, 91, 51, 126] => :key_delete, # Del
+ [27, 91, 49, 126] => :ed_move_to_beg, # Home
+ [27, 91, 52, 126] => :ed_move_to_end, # End
+ }.each_key(&:freeze).freeze,
+ }.freeze
+
@@input = STDIN
def self.input=(val)
@@input = val