Class: Reline::GeneralIO

Inherits:
Object
  • Object
show all
Defined in:
lib/reline/general_io.rb

Constant Summary collapse

RESET_COLOR =

Do not send color reset sequence

''
@@buf =
[]
@@input =
STDIN
@@pasting =
false

Class Method Summary collapse

Class Method Details

.clear_screenObject



91
92
# File 'lib/reline/general_io.rb', line 91

def self.clear_screen
end

.cursor_posObject



66
67
68
# File 'lib/reline/general_io.rb', line 66

def self.cursor_pos
  Reline::CursorPos.new(1, 1)
end

.deprep(otio) ⇒ Object



109
110
# File 'lib/reline/general_io.rb', line 109

def self.deprep(otio)
end

.encodingObject



15
16
17
18
19
20
21
22
23
# File 'lib/reline/general_io.rb', line 15

def self.encoding
  if defined?(@@encoding)
    @@encoding
  elsif RUBY_PLATFORM =~ /mswin|mingw/
    Encoding::UTF_8
  else
    Encoding::default_external
  end
end

.erase_after_cursorObject



85
86
# File 'lib/reline/general_io.rb', line 85

def self.erase_after_cursor
end

.get_screen_sizeObject



62
63
64
# File 'lib/reline/general_io.rb', line 62

def self.get_screen_size
  [24, 80]
end

.getc(_timeout_second) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/reline/general_io.rb', line 43

def self.getc(_timeout_second)
  unless @@buf.empty?
    return @@buf.shift
  end
  c = nil
  loop do
    Reline.core.line_editor.handle_signal
    result = @@input.wait_readable(0.1)
    next if result.nil?
    c = @@input.read(1)
    break
  end
  c&.ord
end

.hide_cursorObject



70
71
# File 'lib/reline/general_io.rb', line 70

def self.hide_cursor
end

.in_pasting?Boolean

Returns:

  • (Boolean)


102
103
104
# File 'lib/reline/general_io.rb', line 102

def self.in_pasting?
  @@pasting
end

.input=(val) ⇒ Object



35
36
37
# File 'lib/reline/general_io.rb', line 35

def self.input=(val)
  @@input = val
end

.move_cursor_column(val) ⇒ Object



76
77
# File 'lib/reline/general_io.rb', line 76

def self.move_cursor_column(val)
end

.move_cursor_down(val) ⇒ Object



82
83
# File 'lib/reline/general_io.rb', line 82

def self.move_cursor_down(val)
end

.move_cursor_up(val) ⇒ Object



79
80
# File 'lib/reline/general_io.rb', line 79

def self.move_cursor_up(val)
end

.prepObject



106
107
# File 'lib/reline/general_io.rb', line 106

def self.prep
end

.reset(encoding: nil) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/reline/general_io.rb', line 6

def self.reset(encoding: nil)
  @@pasting = false
  if encoding
    @@encoding = encoding
  elsif defined?(@@encoding)
    remove_class_variable(:@@encoding)
  end
end

.scroll_down(val) ⇒ Object



88
89
# File 'lib/reline/general_io.rb', line 88

def self.scroll_down(val)
end

.set_default_key_bindings(_) ⇒ Object



29
30
# File 'lib/reline/general_io.rb', line 29

def self.set_default_key_bindings(_)
end

.set_screen_size(rows, columns) ⇒ Object



94
95
# File 'lib/reline/general_io.rb', line 94

def self.set_screen_size(rows, columns)
end

.set_winch_handler(&handler) ⇒ Object



97
98
# File 'lib/reline/general_io.rb', line 97

def self.set_winch_handler(&handler)
end

.show_cursorObject



73
74
# File 'lib/reline/general_io.rb', line 73

def self.show_cursor
end

.ungetc(c) ⇒ Object



58
59
60
# File 'lib/reline/general_io.rb', line 58

def self.ungetc(c)
  @@buf.unshift(c)
end

.win?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/reline/general_io.rb', line 25

def self.win?
  false
end

.with_raw_inputObject



39
40
41
# File 'lib/reline/general_io.rb', line 39

def self.with_raw_input
  yield
end