Class: Reline::GeneralIO
- Inherits:
-
Object
- Object
- Reline::GeneralIO
- Defined in:
- lib/reline/general_io.rb
Constant Summary collapse
- @@buf =
[]
- @@input =
STDIN
- @@pasting =
false
Class Method Summary collapse
- .clear_screen ⇒ Object
- .cursor_pos ⇒ Object
- .deprep(otio) ⇒ Object
- .encoding ⇒ Object
- .erase_after_cursor ⇒ Object
- .finish_pasting ⇒ Object
- .get_screen_size ⇒ Object
- .getc ⇒ Object
- .hide_cursor ⇒ Object
- .in_pasting? ⇒ Boolean
- .input=(val) ⇒ Object
- .move_cursor_column(val) ⇒ Object
- .move_cursor_down(val) ⇒ Object
- .move_cursor_up(val) ⇒ Object
- .prep ⇒ Object
- .reset(encoding: nil) ⇒ Object
- .scroll_down(val) ⇒ Object
- .set_default_key_bindings(_) ⇒ Object
- .set_screen_size(rows, columns) ⇒ Object
- .set_winch_handler(&handler) ⇒ Object
- .show_cursor ⇒ Object
- .start_pasting ⇒ Object
- .ungetc(c) ⇒ Object
- .win? ⇒ Boolean
- .with_raw_input ⇒ Object
Class Method Details
.clear_screen ⇒ Object
85 86 |
# File 'lib/reline/general_io.rb', line 85 def self.clear_screen end |
.cursor_pos ⇒ Object
60 61 62 |
# File 'lib/reline/general_io.rb', line 60 def self.cursor_pos Reline::CursorPos.new(1, 1) end |
.deprep(otio) ⇒ Object
111 112 |
# File 'lib/reline/general_io.rb', line 111 def self.deprep(otio) end |
.encoding ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/reline/general_io.rb', line 10 def self.encoding if defined?(@@encoding) @@encoding elsif RUBY_PLATFORM =~ /mswin|mingw/ Encoding::UTF_8 else Encoding::default_external end end |
.erase_after_cursor ⇒ Object
79 80 |
# File 'lib/reline/general_io.rb', line 79 def self.erase_after_cursor end |
.finish_pasting ⇒ Object
104 105 106 |
# File 'lib/reline/general_io.rb', line 104 def self.finish_pasting @@pasting = false end |
.get_screen_size ⇒ Object
56 57 58 |
# File 'lib/reline/general_io.rb', line 56 def self.get_screen_size [1, 1] end |
.getc ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/reline/general_io.rb', line 38 def self.getc unless @@buf.empty? return @@buf.shift end c = nil loop do result = @@input.wait_readable(0.1) next if result.nil? c = @@input.read(1) break end c&.ord end |
.hide_cursor ⇒ Object
64 65 |
# File 'lib/reline/general_io.rb', line 64 def self.hide_cursor end |
.in_pasting? ⇒ Boolean
96 97 98 |
# File 'lib/reline/general_io.rb', line 96 def self.in_pasting? @@pasting end |
.input=(val) ⇒ Object
30 31 32 |
# File 'lib/reline/general_io.rb', line 30 def self.input=(val) @@input = val end |
.move_cursor_column(val) ⇒ Object
70 71 |
# File 'lib/reline/general_io.rb', line 70 def self.move_cursor_column(val) end |
.move_cursor_down(val) ⇒ Object
76 77 |
# File 'lib/reline/general_io.rb', line 76 def self.move_cursor_down(val) end |
.move_cursor_up(val) ⇒ Object
73 74 |
# File 'lib/reline/general_io.rb', line 73 def self.move_cursor_up(val) end |
.prep ⇒ Object
108 109 |
# File 'lib/reline/general_io.rb', line 108 def self.prep end |
.reset(encoding: nil) ⇒ Object
5 6 7 8 |
# File 'lib/reline/general_io.rb', line 5 def self.reset(encoding: nil) @@pasting = false @@encoding = encoding end |
.scroll_down(val) ⇒ Object
82 83 |
# File 'lib/reline/general_io.rb', line 82 def self.scroll_down(val) end |
.set_default_key_bindings(_) ⇒ Object
24 25 |
# File 'lib/reline/general_io.rb', line 24 def self.set_default_key_bindings(_) end |
.set_screen_size(rows, columns) ⇒ Object
88 89 |
# File 'lib/reline/general_io.rb', line 88 def self.set_screen_size(rows, columns) end |
.set_winch_handler(&handler) ⇒ Object
91 92 |
# File 'lib/reline/general_io.rb', line 91 def self.set_winch_handler(&handler) end |
.show_cursor ⇒ Object
67 68 |
# File 'lib/reline/general_io.rb', line 67 def self.show_cursor end |
.start_pasting ⇒ Object
100 101 102 |
# File 'lib/reline/general_io.rb', line 100 def self.start_pasting @@pasting = true end |
.ungetc(c) ⇒ Object
52 53 54 |
# File 'lib/reline/general_io.rb', line 52 def self.ungetc(c) @@buf.unshift(c) end |
.win? ⇒ Boolean
20 21 22 |
# File 'lib/reline/general_io.rb', line 20 def self.win? false end |
.with_raw_input ⇒ Object
34 35 36 |
# File 'lib/reline/general_io.rb', line 34 def self.with_raw_input yield end |