Class: Termplot::Cursors::BufferedConsoleCursor
Constant Summary
Termplot::ControlChars::BACK, Termplot::ControlChars::CR, Termplot::ControlChars::DOWN, Termplot::ControlChars::FORWARD, Termplot::ControlChars::NEWLINE, Termplot::ControlChars::UP
Instance Attribute Summary collapse
#position, #window
Instance Method Summary
collapse
#beginning_of_line?, #col, #reset_position, #row, #writeable?
Constructor Details
Returns a new instance of BufferedConsoleCursor.
7
8
9
10
|
# File 'lib/termplot/cursors/buffered_console_cursor.rb', line 7
def initialize(window, buffer)
super(window)
@buffer = buffer
end
|
Instance Attribute Details
#buffer ⇒ Object
Returns the value of attribute buffer.
5
6
7
|
# File 'lib/termplot/cursors/buffered_console_cursor.rb', line 5
def buffer
@buffer
end
|
Instance Method Details
#back(n = 1) ⇒ Object
24
25
26
27
|
# File 'lib/termplot/cursors/buffered_console_cursor.rb', line 24
def back(n = 1)
moved = super(n)
moved.times { buffer << BACK }
end
|
#beginning_of_line ⇒ Object
39
40
41
42
|
# File 'lib/termplot/cursors/buffered_console_cursor.rb', line 39
def beginning_of_line
super
buffer << CR
end
|
#clear_buffer ⇒ Object
48
49
50
|
# File 'lib/termplot/cursors/buffered_console_cursor.rb', line 48
def clear_buffer
buffer.clear
end
|
#col= ⇒ Object
64
65
66
|
# File 'lib/termplot/cursors/buffered_console_cursor.rb', line 64
def col=()
raise "Cannot set cursor position directly"
end
|
#down(n = 1) ⇒ Object
34
35
36
37
|
# File 'lib/termplot/cursors/buffered_console_cursor.rb', line 34
def down(n=1)
moved = super(n)
moved.times { buffer << DOWN }
end
|
#flush ⇒ Object
52
53
54
|
# File 'lib/termplot/cursors/buffered_console_cursor.rb', line 52
def flush
buffer.join
end
|
#forward(n = 1) ⇒ Object
19
20
21
22
|
# File 'lib/termplot/cursors/buffered_console_cursor.rb', line 19
def forward(n = 1)
moved = super(n)
moved.times { buffer << FORWARD }
end
|
#new_line ⇒ Object
44
45
46
|
# File 'lib/termplot/cursors/buffered_console_cursor.rb', line 44
def new_line
buffer << NEWLINE
end
|
#position= ⇒ Object
56
57
58
|
# File 'lib/termplot/cursors/buffered_console_cursor.rb', line 56
def position=()
raise "Cannot set cursor position directly"
end
|
#row= ⇒ Object
60
61
62
|
# File 'lib/termplot/cursors/buffered_console_cursor.rb', line 60
def row=()
raise "Cannot set cursor position directly"
end
|
#up(n = 1) ⇒ Object
29
30
31
32
|
# File 'lib/termplot/cursors/buffered_console_cursor.rb', line 29
def up(n=1)
moved = super(n)
moved.times { buffer << UP }
end
|
#write(char) ⇒ Object
12
13
14
15
16
17
|
# File 'lib/termplot/cursors/buffered_console_cursor.rb', line 12
def write(char)
if writeable?
buffer << char
super(char)
end
end
|