vedeu 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/views/_interfaces.rb +127 -0
- data/examples/views/empty_template.rb +10 -0
- data/examples/views/expected/vedeu_full_screen.html +140 -0
- data/examples/views/expected/vedeu_full_screen.json +96050 -0
- data/examples/views/expected/vedeu_full_screen.out +1 -0
- data/examples/views/expected/vedeu_full_screen.txt +50 -0
- data/examples/views/expected/vedeu_line.html +140 -0
- data/examples/views/expected/vedeu_line.json +96050 -0
- data/examples/views/expected/vedeu_line.out +1 -0
- data/examples/views/expected/vedeu_line.txt +58 -0
- data/examples/views/expected/vedeu_lines.html +140 -0
- data/examples/views/expected/vedeu_lines.json +96050 -0
- data/examples/views/expected/{lines.out → vedeu_lines.out} +1 -1
- data/examples/views/expected/vedeu_lines_alignment.html +80 -0
- data/examples/views/expected/vedeu_lines_alignment.json +46370 -0
- data/examples/views/expected/vedeu_lines_alignment.out +1 -0
- data/examples/views/full_screen.rb +10 -0
- data/examples/views/line.rb +11 -106
- data/examples/views/lines.rb +8 -127
- data/examples/views/lines_alignment.rb +17 -125
- data/examples/views/runner.sh +65 -19
- data/lib/vedeu/borders/border.rb +6 -6
- data/lib/vedeu/borders/refresh.rb +4 -6
- data/lib/vedeu/buffers/buffer.rb +1 -1
- data/lib/vedeu/buffers/terminal.rb +4 -4
- data/lib/vedeu/buffers/view.rb +2 -2
- data/lib/vedeu/cells/all.rb +2 -2
- data/lib/vedeu/cells/border.rb +5 -0
- data/lib/vedeu/cells/borders/all.rb +2 -8
- data/lib/vedeu/cells/borders/edges/all.rb +6 -0
- data/lib/vedeu/cells/borders/{bottom_horizontal.rb → edges/bottom_horizontal.rb} +0 -0
- data/lib/vedeu/cells/borders/{left_vertical.rb → edges/left_vertical.rb} +0 -0
- data/lib/vedeu/cells/borders/{right_vertical.rb → edges/right_vertical.rb} +0 -0
- data/lib/vedeu/cells/borders/{top_horizontal.rb → edges/top_horizontal.rb} +0 -0
- data/lib/vedeu/cells/borders/horizontal.rb +5 -0
- data/lib/vedeu/cells/borders/vertical.rb +5 -0
- data/lib/vedeu/cells/borders/vertices/all.rb +6 -0
- data/lib/vedeu/cells/borders/{bottom_left.rb → vertices/bottom_left.rb} +5 -0
- data/lib/vedeu/cells/borders/{bottom_right.rb → vertices/bottom_right.rb} +5 -0
- data/lib/vedeu/cells/borders/{top_left.rb → vertices/top_left.rb} +5 -0
- data/lib/vedeu/cells/borders/{top_right.rb → vertices/top_right.rb} +5 -0
- data/lib/vedeu/cells/char.rb +16 -0
- data/lib/vedeu/cells/clear.rb +5 -0
- data/lib/vedeu/cells/cursor.rb +70 -0
- data/lib/vedeu/cells/empty.rb +24 -14
- data/lib/vedeu/cells/escape.rb +8 -7
- data/lib/vedeu/cells/support/all.rb +3 -0
- data/lib/vedeu/cells/support/html.rb +98 -0
- data/lib/vedeu/colours/background.rb +21 -1
- data/lib/vedeu/colours/colour.rb +10 -2
- data/lib/vedeu/colours/foreground.rb +21 -1
- data/lib/vedeu/colours/translator.rb +17 -24
- data/lib/vedeu/colours/validator.rb +9 -9
- data/lib/vedeu/configuration/api.rb +1 -1
- data/lib/vedeu/cursors/cursor.rb +5 -5
- data/lib/vedeu/dsl/elements.rb +22 -79
- data/lib/vedeu/dsl/string/text.rb +3 -3
- data/lib/vedeu/editor/cropper.rb +2 -2
- data/lib/vedeu/editor/cursor.rb +1 -1
- data/lib/vedeu/editor/document.rb +1 -1
- data/lib/vedeu/geometries/area/dimension.rb +1 -1
- data/lib/vedeu/geometries/position.rb +5 -2
- data/lib/vedeu/interfaces/clear.rb +5 -5
- data/lib/vedeu/models/row.rb +4 -3
- data/lib/vedeu/output/compressor.rb +7 -7
- data/lib/vedeu/output/output.rb +8 -13
- data/lib/vedeu/output/viewport.rb +1 -1
- data/lib/vedeu/presentation/background.rb +2 -2
- data/lib/vedeu/presentation/colour.rb +0 -4
- data/lib/vedeu/presentation/foreground.rb +2 -2
- data/lib/vedeu/presentation/style.rb +1 -1
- data/lib/vedeu/presentation/styles.rb +0 -3
- data/lib/vedeu/renderers/file.rb +10 -68
- data/lib/vedeu/renderers/html.rb +28 -96
- data/lib/vedeu/renderers/json.rb +15 -31
- data/lib/vedeu/renderers/options.rb +160 -14
- data/lib/vedeu/renderers/templates/html_renderer.vedeu +1 -0
- data/lib/vedeu/renderers/terminal.rb +16 -17
- data/lib/vedeu/renderers/text.rb +32 -41
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/all.rb +0 -2
- data/lib/vedeu/views/chars.rb +6 -3
- data/lib/vedeu/views/stream.rb +3 -2
- data/test/lib/vedeu/borders/caption_test.rb +17 -17
- data/test/lib/vedeu/borders/title_test.rb +12 -12
- data/test/lib/vedeu/cells/border_test.rb +6 -0
- data/test/lib/vedeu/cells/borders/{bottom_horizontal_test.rb → edges/bottom_horizontal_test.rb} +0 -0
- data/test/lib/vedeu/cells/borders/{left_vertical_test.rb → edges/left_vertical_test.rb} +0 -0
- data/test/lib/vedeu/cells/borders/{right_vertical_test.rb → edges/right_vertical_test.rb} +0 -0
- data/test/lib/vedeu/cells/borders/{top_horizontal_test.rb → edges/top_horizontal_test.rb} +0 -0
- data/test/lib/vedeu/cells/borders/horizontal_test.rb +6 -0
- data/test/lib/vedeu/cells/borders/vertical_test.rb +6 -0
- data/test/lib/vedeu/cells/borders/{bottom_left_test.rb → vertices/bottom_left_test.rb} +6 -0
- data/test/lib/vedeu/cells/borders/{bottom_right_test.rb → vertices/bottom_right_test.rb} +6 -0
- data/test/lib/vedeu/cells/borders/{top_left_test.rb → vertices/top_left_test.rb} +6 -0
- data/test/lib/vedeu/cells/borders/{top_right_test.rb → vertices/top_right_test.rb} +6 -0
- data/test/lib/vedeu/cells/char_test.rb +18 -0
- data/test/lib/vedeu/cells/clear_test.rb +6 -0
- data/test/lib/vedeu/cells/cursor_test.rb +113 -0
- data/test/lib/vedeu/cells/empty_test.rb +100 -7
- data/test/lib/vedeu/cells/escape_test.rb +29 -13
- data/test/lib/vedeu/cells/support/html_test.rb +100 -0
- data/test/lib/vedeu/colours/background_test.rb +35 -3
- data/test/lib/vedeu/colours/colour_test.rb +66 -0
- data/test/lib/vedeu/colours/foreground_test.rb +35 -3
- data/test/lib/vedeu/colours/translator_test.rb +0 -34
- data/test/lib/vedeu/colours/validator_test.rb +84 -6
- data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
- data/test/lib/vedeu/cursors/refresh_test.rb +4 -1
- data/test/lib/vedeu/dsl/string/text_test.rb +36 -36
- data/test/lib/vedeu/editor/cropper_test.rb +15 -15
- data/test/lib/vedeu/geometries/position_test.rb +14 -1
- data/test/lib/vedeu/models/page_test.rb +10 -10
- data/test/lib/vedeu/models/row_test.rb +7 -7
- data/test/lib/vedeu/output/compressor_test.rb +63 -50
- data/test/lib/vedeu/renderers/file_test.rb +64 -35
- data/test/lib/vedeu/renderers/html_test.rb +15 -12
- data/test/lib/vedeu/renderers/json_test.rb +79 -56
- data/test/lib/vedeu/renderers/options_test.rb +74 -26
- data/test/lib/vedeu/renderers/terminal_test.rb +34 -4
- data/test/lib/vedeu/renderers/text_test.rb +35 -3
- data/test/lib/vedeu/views/chars_test.rb +6 -0
- metadata +50 -41
- data/examples/views/expected/line.out +0 -1
- data/examples/views/expected/lines_alignment.out +0 -1
- data/lib/vedeu/cells/html.rb +0 -21
- data/lib/vedeu/cells/json.rb +0 -21
- data/lib/vedeu/views/char.rb +0 -180
- data/lib/vedeu/views/html_char.rb +0 -133
- data/test/lib/vedeu/cells/html_test.rb +0 -15
- data/test/lib/vedeu/cells/json_test.rb +0 -15
- data/test/lib/vedeu/views/char_test.rb +0 -283
- data/test/lib/vedeu/views/html_char_test.rb +0 -125
data/lib/vedeu/cursors/cursor.rb
CHANGED
@@ -162,7 +162,7 @@ module Vedeu
|
|
162
162
|
|
163
163
|
# Renders the cursor.
|
164
164
|
#
|
165
|
-
# @return [Array<Vedeu::Cells::
|
165
|
+
# @return [Array<Vedeu::Cells::Cursor>]
|
166
166
|
def render
|
167
167
|
Vedeu.render_output(escape_sequence)
|
168
168
|
end
|
@@ -196,7 +196,7 @@ module Vedeu
|
|
196
196
|
# Vedeu.hide_cursor(Vedeu.focus)
|
197
197
|
# Vedeu.hide_cursor
|
198
198
|
#
|
199
|
-
# @return [Vedeu::Cells::
|
199
|
+
# @return [Vedeu::Cells::Cursor]
|
200
200
|
def hide
|
201
201
|
super
|
202
202
|
|
@@ -233,7 +233,7 @@ module Vedeu
|
|
233
233
|
# Vedeu.show_cursor(Vedeu.focus)
|
234
234
|
# Vedeu.show_cursor
|
235
235
|
#
|
236
|
-
# @return [Vedeu::Cells::
|
236
|
+
# @return [Vedeu::Cells::Cursor]
|
237
237
|
def show
|
238
238
|
super
|
239
239
|
|
@@ -290,9 +290,9 @@ module Vedeu
|
|
290
290
|
}
|
291
291
|
end
|
292
292
|
|
293
|
-
# @return [Vedeu::Cells::
|
293
|
+
# @return [Vedeu::Cells::Cursor]
|
294
294
|
def escape_sequence
|
295
|
-
Vedeu::Cells::
|
295
|
+
Vedeu::Cells::Cursor.new(position: position, value: visibility)
|
296
296
|
end
|
297
297
|
|
298
298
|
# @return [Hash<Symbol => Fixnum>]
|
data/lib/vedeu/dsl/elements.rb
CHANGED
@@ -69,9 +69,28 @@ module Vedeu
|
|
69
69
|
|
70
70
|
attrs = Vedeu::DSL::Attributes.build(self, model, nil, {}, &block)
|
71
71
|
|
72
|
-
|
73
|
-
|
72
|
+
if view_model?
|
73
|
+
if model.lines?
|
74
|
+
l = Vedeu::Views::Line.build(attrs, &block)
|
75
|
+
model.add(l)
|
76
|
+
|
77
|
+
else
|
78
|
+
l = Vedeu::Views::View.build(attrs, &block)
|
79
|
+
model.value = l.value
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
elsif line_model?
|
84
|
+
l = Vedeu::Views::Line.build(attrs, &block)
|
85
|
+
model.value = l.value
|
86
|
+
|
87
|
+
else
|
88
|
+
l = Vedeu::Views::View.build(attrs, &block)
|
89
|
+
model.value = l.value
|
90
|
+
|
91
|
+
end
|
74
92
|
end
|
93
|
+
alias_method :streams, :lines
|
75
94
|
|
76
95
|
# @todo This documentation needs editing. (GL: 2015-12-17)
|
77
96
|
#
|
@@ -121,83 +140,7 @@ module Vedeu
|
|
121
140
|
|
122
141
|
end
|
123
142
|
end
|
124
|
-
|
125
|
-
# @todo This documentation needs editing. (GL: 2015-12-17)
|
126
|
-
#
|
127
|
-
# Define multiple streams (a stream is a subset of a line).
|
128
|
-
# Uses {Vedeu::DSL::Stream} for all directives within the
|
129
|
-
# required block.
|
130
|
-
#
|
131
|
-
# Vedeu.renders do
|
132
|
-
# view :my_interface do
|
133
|
-
# lines do
|
134
|
-
# line do
|
135
|
-
# streams do
|
136
|
-
# # ... some code
|
137
|
-
# end
|
138
|
-
#
|
139
|
-
# stream do
|
140
|
-
# # ... some code
|
141
|
-
# end
|
142
|
-
# end
|
143
|
-
# end
|
144
|
-
# end
|
145
|
-
# end
|
146
|
-
#
|
147
|
-
# @param block [Proc]
|
148
|
-
# @macro raise_requires_block
|
149
|
-
# @raise [Vedeu::Error::Fatal]
|
150
|
-
# @return [void]
|
151
|
-
def streams(&block)
|
152
|
-
requires_block!(&block)
|
153
|
-
requires_model!
|
154
|
-
|
155
|
-
attrs = Vedeu::DSL::Attributes.build(self, model, nil, {}, &block)
|
156
|
-
|
157
|
-
l = Vedeu::Views::Line.build(attrs, &block)
|
158
|
-
|
159
|
-
if view_model?
|
160
|
-
model.add(l)
|
161
|
-
|
162
|
-
elsif line_model?
|
163
|
-
model.value = l.value
|
164
|
-
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
# @todo This documentation needs editing. (GL: 2015-12-17)
|
169
|
-
#
|
170
|
-
# @param value [String]
|
171
|
-
# @param opts [Hash]
|
172
|
-
# @option opts ... [void]
|
173
|
-
# @param block [Proc]
|
174
|
-
# @raise [Vedeu::Error::Fatal]
|
175
|
-
# @return [void]
|
176
|
-
def stream(value = '', opts = {}, &block)
|
177
|
-
requires_model!
|
178
|
-
|
179
|
-
attrs = Vedeu::DSL::Attributes.build(self, model, value, opts, &block)
|
180
|
-
|
181
|
-
l = if block_given?
|
182
|
-
Vedeu::Views::Line.build(attrs, &block)
|
183
|
-
|
184
|
-
else
|
185
|
-
s = Vedeu::Views::Stream.new(attrs)
|
186
|
-
ss = Vedeu::Views::Streams.coerce([s])
|
187
|
-
|
188
|
-
Vedeu::Views::Line.new(attrs.merge!(value: ss))
|
189
|
-
|
190
|
-
end
|
191
|
-
|
192
|
-
if view_model? || line_model?
|
193
|
-
model.add(l)
|
194
|
-
|
195
|
-
else
|
196
|
-
fail Vedeu::Error::Fatal,
|
197
|
-
"Cannot add line to '#{model.class.name}' model."
|
198
|
-
|
199
|
-
end
|
200
|
-
end
|
143
|
+
alias_method :stream, :line
|
201
144
|
|
202
145
|
# @todo This documentation needs editing. (GL: 2015-12-17)
|
203
146
|
#
|
@@ -21,7 +21,7 @@ module Vedeu
|
|
21
21
|
@options = options || {}
|
22
22
|
end
|
23
23
|
|
24
|
-
# @return [Array<Vedeu::
|
24
|
+
# @return [Array<Vedeu::Cells::Char>]
|
25
25
|
def chars
|
26
26
|
return [] unless present?(value) && string?(value)
|
27
27
|
|
@@ -63,9 +63,9 @@ module Vedeu
|
|
63
63
|
}
|
64
64
|
end
|
65
65
|
|
66
|
-
# @return [Array<Vedeu::
|
66
|
+
# @return [Array<Vedeu::Cells::Char>]
|
67
67
|
def collection
|
68
|
-
text.chars.map { |char| Vedeu::
|
68
|
+
text.chars.map { |char| Vedeu::Cells::Char.new(attributes(char)) }
|
69
69
|
end
|
70
70
|
|
71
71
|
# @return [NilClass|String|Symbol]
|
data/lib/vedeu/editor/cropper.rb
CHANGED
@@ -36,7 +36,7 @@ module Vedeu
|
|
36
36
|
@oy = oy
|
37
37
|
end
|
38
38
|
|
39
|
-
# Returns the visible lines as a sequence of {Vedeu::
|
39
|
+
# Returns the visible lines as a sequence of {Vedeu::Cells::Char}
|
40
40
|
# objects.
|
41
41
|
#
|
42
42
|
# @return [Array<void>]
|
@@ -45,7 +45,7 @@ module Vedeu
|
|
45
45
|
|
46
46
|
visible.each_with_index do |line, iy|
|
47
47
|
line.chars.each_with_index do |char, ix|
|
48
|
-
out << Vedeu::
|
48
|
+
out << Vedeu::Cells::Char.new(name: name,
|
49
49
|
position: [(by + iy), (bx + ix)],
|
50
50
|
value: char)
|
51
51
|
end
|
data/lib/vedeu/editor/cursor.rb
CHANGED
@@ -91,7 +91,7 @@ module Vedeu
|
|
91
91
|
# document being edited.
|
92
92
|
#
|
93
93
|
# @return [Vedeu::Editor::Cursor]
|
94
|
-
# @todo
|
94
|
+
# @todo Should ox/oy be 0; or set to @ox/@oy? (GL: 2015-10-02)
|
95
95
|
def refresh
|
96
96
|
Vedeu::Cursors::Cursor.store(name: name,
|
97
97
|
x: real_x,
|
@@ -257,7 +257,7 @@ module Vedeu
|
|
257
257
|
# representation of the full document depending on the size of
|
258
258
|
# the interface.
|
259
259
|
#
|
260
|
-
# @return [Array<Vedeu::
|
260
|
+
# @return [Array<Vedeu::Cells::Char>]
|
261
261
|
def output
|
262
262
|
Vedeu::Editor::Cropper.new(lines: lines,
|
263
263
|
name: name,
|
@@ -115,7 +115,7 @@ module Vedeu
|
|
115
115
|
# length from the values provided.
|
116
116
|
#
|
117
117
|
# @return [Boolean]
|
118
|
-
# @todo
|
118
|
+
# @todo Investigate: should this be && or ||. (GL: 2015-10-16)
|
119
119
|
def length?
|
120
120
|
default && length
|
121
121
|
end
|
@@ -103,10 +103,13 @@ module Vedeu
|
|
103
103
|
# @return [Hash<Symbol => Fixnum|NilClass>]
|
104
104
|
def to_h
|
105
105
|
{
|
106
|
-
|
107
|
-
|
106
|
+
position: {
|
107
|
+
y: y,
|
108
|
+
x: x,
|
109
|
+
}
|
108
110
|
}
|
109
111
|
end
|
112
|
+
alias_method :to_hash, :to_h
|
110
113
|
|
111
114
|
# Return the escape sequence required to position the cursor at
|
112
115
|
# a particular point on the screen. When passed a block, will do
|
@@ -18,7 +18,7 @@ module Vedeu
|
|
18
18
|
# Vedeu.trigger(:_clear_view_, name)
|
19
19
|
# Vedeu.clear_by_name(name)
|
20
20
|
#
|
21
|
-
# @return [Array<Array<Vedeu::
|
21
|
+
# @return [Array<Array<Vedeu::Cells::Char>>]
|
22
22
|
# @see #initialize
|
23
23
|
def render(name = Vedeu.focus)
|
24
24
|
name || Vedeu.focus
|
@@ -34,7 +34,7 @@ module Vedeu
|
|
34
34
|
# Vedeu.trigger(:_clear_view_content_, name)
|
35
35
|
# Vedeu.clear_content_by_name(name)
|
36
36
|
#
|
37
|
-
# @return [Array<Array<Vedeu::
|
37
|
+
# @return [Array<Array<Vedeu::Cells::Char>>]
|
38
38
|
# @see #initialize
|
39
39
|
def clear_content_by_name(name = Vedeu.focus)
|
40
40
|
name || Vedeu.focus
|
@@ -55,14 +55,14 @@ module Vedeu
|
|
55
55
|
# to the terminal using a faster mechanism. The virtual buffer
|
56
56
|
# will still be updated. This improves the refresh time for
|
57
57
|
# Vedeu as we will not be building a grid of
|
58
|
-
# {Vedeu::
|
58
|
+
# {Vedeu::Cells::Char} objects.
|
59
59
|
# @return [Vedeu::Interfaces::Clear]
|
60
60
|
def initialize(name, options = {})
|
61
61
|
@name = present?(name) ? name : Vedeu.focus
|
62
62
|
@options = options
|
63
63
|
end
|
64
64
|
|
65
|
-
# @return [Array<Array<Vedeu::
|
65
|
+
# @return [Array<Array<Vedeu::Cells::Char>>]
|
66
66
|
def render
|
67
67
|
if direct?
|
68
68
|
Vedeu.direct_write(optimised_output)
|
@@ -157,7 +157,7 @@ module Vedeu
|
|
157
157
|
# defined, then starting write space characters over the area
|
158
158
|
# which the interface occupies.
|
159
159
|
#
|
160
|
-
# @return [Array<Array<Vedeu::
|
160
|
+
# @return [Array<Array<Vedeu::Cells::Char>>]
|
161
161
|
def output
|
162
162
|
Vedeu.timer("Clearing #{clearing}: '#{name}'") do
|
163
163
|
@clear ||= Array.new(height) do |iy|
|
data/lib/vedeu/models/row.rb
CHANGED
@@ -9,6 +9,7 @@ module Vedeu
|
|
9
9
|
class Row
|
10
10
|
|
11
11
|
include Enumerable
|
12
|
+
include Vedeu::Common
|
12
13
|
|
13
14
|
# @!attribute [r] cells
|
14
15
|
# @return [Array<NilClass|void>]
|
@@ -43,7 +44,7 @@ module Vedeu
|
|
43
44
|
# @param index [Fixnum]
|
44
45
|
# @return [NilClass|void]
|
45
46
|
def cell(index)
|
46
|
-
return nil if index.nil?
|
47
|
+
return nil if index.nil? || empty?
|
47
48
|
|
48
49
|
cells[index]
|
49
50
|
end
|
@@ -79,9 +80,9 @@ module Vedeu
|
|
79
80
|
# reset colour and style information to prevent colour bleed on
|
80
81
|
# the next line.
|
81
82
|
#
|
82
|
-
# @return [Vedeu::
|
83
|
+
# @return [Vedeu::Cells::Escape]
|
83
84
|
def reset_character
|
84
|
-
Vedeu::
|
85
|
+
Vedeu::Cells::Escape.new(value: Vedeu.esc.reset)
|
85
86
|
end
|
86
87
|
|
87
88
|
# @return [Fixnum]
|
@@ -4,7 +4,7 @@ module Vedeu
|
|
4
4
|
|
5
5
|
module Output
|
6
6
|
|
7
|
-
# During the conversion of a Vedeu::
|
7
|
+
# During the conversion of a Vedeu::Cells::Char object into a
|
8
8
|
# string of escape sequences, this class removes multiple
|
9
9
|
# occurences of the same escape sequence, resulting in a smaller
|
10
10
|
# payload being sent to the renderer.
|
@@ -24,7 +24,7 @@ module Vedeu
|
|
24
24
|
|
25
25
|
# Returns a new instance of Vedeu::Output::Compressor.
|
26
26
|
#
|
27
|
-
# @param output [Array<Array<Vedeu::
|
27
|
+
# @param output [Array<Array<Vedeu::Cells::Char>>]
|
28
28
|
# @param options [Hash]
|
29
29
|
# @option options compression [Boolean]
|
30
30
|
# @return [Vedeu::Output::Compressor]
|
@@ -40,7 +40,7 @@ module Vedeu
|
|
40
40
|
# - Takes approximately ~25ms for 2100 chars. (2015-07-25)
|
41
41
|
# @return [String]
|
42
42
|
def render
|
43
|
-
return cached if
|
43
|
+
return cached if compression?
|
44
44
|
|
45
45
|
uncompress
|
46
46
|
end
|
@@ -48,7 +48,7 @@ module Vedeu
|
|
48
48
|
protected
|
49
49
|
|
50
50
|
# @!attribute [r] output
|
51
|
-
# @return [Array<Array<Vedeu::
|
51
|
+
# @return [Array<Array<Vedeu::Cells::Char>>]
|
52
52
|
attr_reader :output
|
53
53
|
|
54
54
|
private
|
@@ -117,7 +117,7 @@ module Vedeu
|
|
117
117
|
# coordinate has changed; i.e. we are on the same line, just
|
118
118
|
# advancing a character.
|
119
119
|
#
|
120
|
-
# @param char [Vedeu::
|
120
|
+
# @param char [Vedeu::Cells::Char]
|
121
121
|
# @return [String]
|
122
122
|
def position_for(char)
|
123
123
|
return '' unless char.position
|
@@ -131,7 +131,7 @@ module Vedeu
|
|
131
131
|
# character which has the same colours as the last character
|
132
132
|
# output.
|
133
133
|
#
|
134
|
-
# @param char [Vedeu::
|
134
|
+
# @param char [Vedeu::Cells::Char]
|
135
135
|
# @return [String]
|
136
136
|
def colour_for(char)
|
137
137
|
return '' if char.colour == @colour
|
@@ -144,7 +144,7 @@ module Vedeu
|
|
144
144
|
# character which has the same style(s) as the last character
|
145
145
|
# output.
|
146
146
|
#
|
147
|
-
# @param char [Vedeu::
|
147
|
+
# @param char [Vedeu::Cells::Char]
|
148
148
|
# @return [String]
|
149
149
|
def style_for(char)
|
150
150
|
return '' if char.style == @style
|
data/lib/vedeu/output/output.rb
CHANGED
@@ -11,8 +11,7 @@ module Vedeu
|
|
11
11
|
#
|
12
12
|
class Output
|
13
13
|
|
14
|
-
# @param output
|
15
|
-
# NilClass|Vedeu::Cells::Escape]
|
14
|
+
# @param output (see #output)
|
16
15
|
# @return [Array]
|
17
16
|
def self.buffer_update(output)
|
18
17
|
return nil if output.nil?
|
@@ -20,8 +19,7 @@ module Vedeu
|
|
20
19
|
new(output).buffer_update
|
21
20
|
end
|
22
21
|
|
23
|
-
# @param output
|
24
|
-
# NilClass|Vedeu::Cells::Escape]
|
22
|
+
# @param output (see #output)
|
25
23
|
# @return [Array]
|
26
24
|
def self.buffer_write(output)
|
27
25
|
return nil if output.nil?
|
@@ -29,8 +27,7 @@ module Vedeu
|
|
29
27
|
new(output).buffer_write
|
30
28
|
end
|
31
29
|
|
32
|
-
# @param output
|
33
|
-
# NilClass|Vedeu::Cells::Escape]
|
30
|
+
# @param output (see #output)
|
34
31
|
# @return [Array<String>]
|
35
32
|
def self.direct_write(output)
|
36
33
|
return nil if output.nil?
|
@@ -40,8 +37,7 @@ module Vedeu
|
|
40
37
|
|
41
38
|
# Writes output to the defined renderers.
|
42
39
|
#
|
43
|
-
# @param output
|
44
|
-
# NilClass|Vedeu::Cells::Escape]
|
40
|
+
# @param output (see #output)
|
45
41
|
# @return [Array|NilClass|String]
|
46
42
|
def self.render_output(output)
|
47
43
|
return nil if output.nil?
|
@@ -51,8 +47,7 @@ module Vedeu
|
|
51
47
|
|
52
48
|
# Return a new instance of Vedeu::Output::Output.
|
53
49
|
#
|
54
|
-
# @param output
|
55
|
-
# NilClass|Vedeu::Cells::Escape]
|
50
|
+
# @param output (see #output)
|
56
51
|
# @return [Vedeu::Output::Output]
|
57
52
|
def initialize(output)
|
58
53
|
@output = output
|
@@ -94,15 +89,15 @@ module Vedeu
|
|
94
89
|
protected
|
95
90
|
|
96
91
|
# @!attribute [r] output
|
97
|
-
# @return [Array<Array<Vedeu::
|
98
|
-
# NilClass|Vedeu::Cells::Escape]
|
92
|
+
# @return [Array<Array<Vedeu::Cells::Char>>|
|
93
|
+
# NilClass|Vedeu::Cells::Escape|Vedeu::Cells::Cursor]
|
99
94
|
attr_reader :output
|
100
95
|
|
101
96
|
private
|
102
97
|
|
103
98
|
# @return [Boolean]
|
104
99
|
def escape_sequence?
|
105
|
-
output.is_a?(Vedeu::Cells::Escape)
|
100
|
+
output.is_a?(Vedeu::Cells::Escape) || output.is_a?(Vedeu::Cells::Cursor)
|
106
101
|
end
|
107
102
|
|
108
103
|
end # Output
|