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/ansi.rb | |
parent | 2d34087a38ac680c5576a56fbf4104c3561b0204 (diff) | |
download | ruby-eb4e774711b17b8a25a7b16c4f0b6044da3dc261.tar.gz |
Support Meta key in Reline
Diffstat (limited to 'lib/reline/ansi.rb')
-rw-r--r-- | lib/reline/ansi.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb index 34720d352c..1ead89b8ff 100644 --- a/lib/reline/ansi.rb +++ b/lib/reline/ansi.rb @@ -9,7 +9,11 @@ class Reline::ANSI @@output = val end + @@buf = [] def self.getc + unless @@buf.empty? + return @@buf.shift + end c = nil loop do result = select([@@input], [], [], 0.1) @@ -20,6 +24,10 @@ class Reline::ANSI c&.ord end + def self.ungetc(c) + @@buf.unshift(c) + end + def self.get_screen_size @@input.winsize rescue Errno::ENOTTY |