mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Retrieve key-buffer that was supposed to lose
This commit is contained in:
parent
142efba93e
commit
934507472c
1 changed files with 10 additions and 0 deletions
|
@ -38,6 +38,15 @@ class Reline::ANSI
|
||||||
@@buf.unshift(c)
|
@@buf.unshift(c)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.retrieve_keybuffer
|
||||||
|
result = select([@@input], [], [], 0.1)
|
||||||
|
return if result.nil?
|
||||||
|
str = @@input.read_nonblock(1024)
|
||||||
|
str.bytes.each do |c|
|
||||||
|
@@buf.push(c)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.get_screen_size
|
def self.get_screen_size
|
||||||
@@input.winsize
|
@@input.winsize
|
||||||
rescue Errno::ENOTTY
|
rescue Errno::ENOTTY
|
||||||
|
@ -112,6 +121,7 @@ class Reline::ANSI
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.prep
|
def self.prep
|
||||||
|
retrieve_keybuffer
|
||||||
int_handle = Signal.trap('INT', 'IGNORE')
|
int_handle = Signal.trap('INT', 'IGNORE')
|
||||||
otio = `stty -g`.chomp
|
otio = `stty -g`.chomp
|
||||||
setting = ' -echo -icrnl cbreak'
|
setting = ' -echo -icrnl cbreak'
|
||||||
|
|
Loading…
Add table
Reference in a new issue