2019-05-13 00:22:27 +09:00
|
|
|
require 'timeout'
|
|
|
|
|
|
|
|
class Reline::GeneralIO
|
2020-01-12 22:24:17 +09:00
|
|
|
def self.encoding
|
2020-01-26 12:55:13 +09:00
|
|
|
RUBY_PLATFORM =~ /mswin|mingw/ ? Encoding::UTF_8 : Encoding::default_external
|
2020-01-12 22:24:17 +09:00
|
|
|
end
|
|
|
|
|
2020-02-01 02:59:46 +09:00
|
|
|
def self.win?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2019-10-18 02:29:13 +09:00
|
|
|
RAW_KEYSTROKE_CONFIG = {}
|
2019-06-01 00:34:38 +09:00
|
|
|
|
2019-05-13 00:22:27 +09:00
|
|
|
@@buf = []
|
|
|
|
|
|
|
|
def self.input=(val)
|
|
|
|
@@input = val
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.getc
|
2019-05-24 23:38:40 +09:00
|
|
|
unless @@buf.empty?
|
|
|
|
return @@buf.shift
|
|
|
|
end
|
2019-05-13 00:22:27 +09:00
|
|
|
c = nil
|
|
|
|
loop do
|
|
|
|
result = select([@@input], [], [], 0.1)
|
|
|
|
next if result.nil?
|
|
|
|
c = @@input.read(1)
|
|
|
|
break
|
|
|
|
end
|
|
|
|
c&.ord
|
|
|
|
end
|
|
|
|
|
2019-05-24 23:38:40 +09:00
|
|
|
def self.ungetc(c)
|
|
|
|
@@buf.unshift(c)
|
|
|
|
end
|
|
|
|
|
2019-05-13 00:22:27 +09:00
|
|
|
def self.get_screen_size
|
|
|
|
[1, 1]
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.cursor_pos
|
|
|
|
Reline::CursorPos.new(1, 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.move_cursor_column(val)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.move_cursor_up(val)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.move_cursor_down(val)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.erase_after_cursor
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.scroll_down(val)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.clear_screen
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.set_screen_size(rows, columns)
|
|
|
|
end
|
|
|
|
|
2019-08-29 15:21:00 +09:00
|
|
|
def self.set_winch_handler(&handler)
|
|
|
|
end
|
|
|
|
|
2019-05-13 00:22:27 +09:00
|
|
|
def self.prep
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.deprep(otio)
|
|
|
|
end
|
|
|
|
end
|