Skip to content

Commit

Permalink
Add support cursor keys.
Browse files Browse the repository at this point in the history
  • Loading branch information
osyo-manga committed Apr 16, 2019
1 parent c20a84f commit 42afeb9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/reline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,16 @@ def self.inner_readline(prompt = '', add_hist = false, multiline, &confirm_multi
@line_editor.completion_proc = @completion_proc
@line_editor.retrieve_completion_block = method(:retrieve_completion_block)
@line_editor.rerender

config = {
key_mapping: {
# TODO
# "a" => "bb",
# "z" => "aa",
# "y" => "ak",
[27, 91, 65] => :ed_prev_history, # ↑
[27, 91, 66] => :ed_next_history, # ↓
[27, 91, 67] => :ed_next_char, # →
[27, 91, 68] => :ed_prev_char # ←
}
}

key_stroke = Reline::KeyStroke.new(config)
begin
while c = getc
Expand Down

0 comments on commit 42afeb9

Please sign in to comment.