Class: Reline::Dumb

Inherits:
IO
  • Object
show all
Defined in:
lib/reline/io/dumb.rb

Constant Summary collapse

RESET_COLOR =

Do not send color reset sequence

''

Instance Method Summary collapse

Methods inherited from IO

decide_io_gate, #reset_color_sequence, #win?

Constructor Details

#initialize(encoding: nil) ⇒ Dumb

Returns a new instance of Dumb.



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

def initialize(encoding: nil)
  @input = STDIN
  @buf = []
  @pasting = false
  @encoding = encoding
  @screen_size = [24, 80]
end

Instance Method Details

#clear_screenObject



87
88
# File 'lib/reline/io/dumb.rb', line 87

def clear_screen
end

#cursor_posObject



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

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

#deprep(otio) ⇒ Object



104
105
# File 'lib/reline/io/dumb.rb', line 104

def deprep(otio)
end

#dumb?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/reline/io/dumb.rb', line 14

def dumb?
  true
end

#encodingObject



18
19
20
21
22
23
24
25
26
# File 'lib/reline/io/dumb.rb', line 18

def encoding
  if @encoding
    @encoding
  elsif RUBY_PLATFORM =~ /mswin|mingw/
    Encoding::UTF_8
  else
    Encoding::default_external
  end
end

#erase_after_cursorObject



81
82
# File 'lib/reline/io/dumb.rb', line 81

def erase_after_cursor
end

#get_screen_sizeObject



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

def get_screen_size
  @screen_size
end

#getc(_timeout_second) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/reline/io/dumb.rb', line 39

def 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



66
67
# File 'lib/reline/io/dumb.rb', line 66

def hide_cursor
end

#in_pasting?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/reline/io/dumb.rb', line 97

def in_pasting?
  @pasting
end

#input=(val) ⇒ Object



31
32
33
# File 'lib/reline/io/dumb.rb', line 31

def input=(val)
  @input = val
end

#move_cursor_column(val) ⇒ Object



72
73
# File 'lib/reline/io/dumb.rb', line 72

def move_cursor_column(val)
end

#move_cursor_down(val) ⇒ Object



78
79
# File 'lib/reline/io/dumb.rb', line 78

def move_cursor_down(val)
end

#move_cursor_up(val) ⇒ Object



75
76
# File 'lib/reline/io/dumb.rb', line 75

def move_cursor_up(val)
end

#prepObject



101
102
# File 'lib/reline/io/dumb.rb', line 101

def prep
end

#scroll_down(val) ⇒ Object



84
85
# File 'lib/reline/io/dumb.rb', line 84

def scroll_down(val)
end

#set_default_key_bindings(_) ⇒ Object



28
29
# File 'lib/reline/io/dumb.rb', line 28

def set_default_key_bindings(_)
end

#set_screen_size(rows, columns) ⇒ Object



90
91
92
# File 'lib/reline/io/dumb.rb', line 90

def set_screen_size(rows, columns)
  @screen_size = [rows, columns]
end

#set_winch_handler(&handler) ⇒ Object



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

def set_winch_handler(&handler)
end

#show_cursorObject



69
70
# File 'lib/reline/io/dumb.rb', line 69

def show_cursor
end

#ungetc(c) ⇒ Object



54
55
56
# File 'lib/reline/io/dumb.rb', line 54

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

#with_raw_inputObject



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

def with_raw_input
  yield
end