Revert "Use IO#getch to read one char in raw mode"
This reverts commit 805b0a481132938638dbd32830cf5dca3910efb1.
This commit is contained in:
parent
e8fff0ec9c
commit
83ef23bd75
@ -1,5 +1,3 @@
|
|||||||
require 'io/console'
|
|
||||||
|
|
||||||
class Reline::ANSI
|
class Reline::ANSI
|
||||||
RAW_KEYSTROKE_CONFIG = {
|
RAW_KEYSTROKE_CONFIG = {
|
||||||
[27, 91, 65] => :ed_prev_history, # ↑
|
[27, 91, 65] => :ed_prev_history, # ↑
|
||||||
@ -26,7 +24,14 @@ class Reline::ANSI
|
|||||||
unless @@buf.empty?
|
unless @@buf.empty?
|
||||||
return @@buf.shift
|
return @@buf.shift
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
def self.ungetc(c)
|
def self.ungetc(c)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user