diff options
author | aycabta <aycabta@gmail.com> | 2019-05-24 23:38:40 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-05-24 23:38:40 +0900 |
commit | eb4e774711b17b8a25a7b16c4f0b6044da3dc261 (patch) | |
tree | d33f0bfb2087ee0169422d08b8553678fd189f75 /lib/reline.rb | |
parent | 2d34087a38ac680c5576a56fbf4104c3561b0204 (diff) | |
download | ruby-eb4e774711b17b8a25a7b16c4f0b6044da3dc261.tar.gz |
Support Meta key in Reline
Diffstat (limited to 'lib/reline.rb')
-rw-r--r-- | lib/reline.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/reline.rb b/lib/reline.rb index ac279b43f0..41f492d50c 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -1,4 +1,5 @@ require 'io/console' +require 'timeout' require 'reline/version' require 'reline/config' require 'reline/key_actor' @@ -6,6 +7,8 @@ require 'reline/key_stroke' require 'reline/line_editor' module Reline + Key = Struct.new('Key', :char, :combined_char, :with_meta) + extend self FILENAME_COMPLETION_PROC = nil USERNAME_COMPLETION_PROC = nil @@ -321,8 +324,7 @@ module Reline key_stroke = Reline::KeyStroke.new(config) begin loop do - c = Reline::IOGate.getc - key_stroke.input_to!(c)&.then { |inputs| + key_stroke.read_io(@@config.keyseq_timeout) { |inputs| inputs.each { |c| @@line_editor.input_key(c) @@line_editor.rerender |