diff options
author | aycabta <aycabta@gmail.com> | 2019-09-14 00:11:01 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-09-14 00:11:01 +0900 |
commit | 83ef23bd75bfee481ea259473742d99d95d2f954 (patch) | |
tree | 6e9ec3fc2600635cf5f9a1d66d279e4012215708 /lib/reline | |
parent | e8fff0ec9cf16487986856c83354c9427e358d1d (diff) |
Revert "Use IO#getch to read one char in raw mode"
This reverts commit 805b0a481132938638dbd32830cf5dca3910efb1.
Diffstat (limited to 'lib/reline')
-rw-r--r-- | lib/reline/ansi.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb index 41f291809e..a3401b9c9f 100644 --- a/lib/reline/ansi.rb +++ b/lib/reline/ansi.rb @@ -1,5 +1,3 @@ -require 'io/console' - class Reline::ANSI RAW_KEYSTROKE_CONFIG = { [27, 91, 65] => :ed_prev_history, # ↑ @@ -26,7 +24,14 @@ class Reline::ANSI unless @@buf.empty? return @@buf.shift end - @@input.getch&.ord + c = nil + loop do + result = select([@@input], [], [], 0.1) + next if result.nil? + c = @@input.read(1) + break + end + c&.ord end def self.ungetc(c) |