vedeu 0.6.15 → 0.6.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -60
- data/config/rubocop_enabled.yml +6 -1023
- data/docs/events/refresh.md +6 -2
- data/docs/events/visibility.md +8 -3
- data/lib/vedeu.rb +4 -3
- data/lib/vedeu/all.rb +3 -2
- data/lib/vedeu/api/external.rb +6 -6
- data/lib/vedeu/bindings/bindings.rb +3 -3
- data/lib/vedeu/bindings/movement.rb +4 -4
- data/lib/vedeu/bindings/refresh.rb +9 -9
- data/lib/vedeu/bindings/visibility.rb +10 -12
- data/lib/vedeu/buffers/buffer.rb +1 -1
- data/lib/vedeu/buffers/refresh.rb +1 -1
- data/lib/vedeu/colours/repository.rb +1 -0
- data/lib/vedeu/colours/translator.rb +2 -6
- data/lib/vedeu/common.rb +2 -1
- data/lib/vedeu/configuration/api.rb +16 -7
- data/lib/vedeu/cursors/cursor.rb +12 -21
- data/lib/vedeu/cursors/refresh.rb +1 -1
- data/lib/vedeu/dsl/text.rb +21 -18
- data/lib/vedeu/dsl/use.rb +13 -11
- data/lib/vedeu/dsl/view.rb +52 -46
- data/lib/vedeu/editor/cursor.rb +2 -2
- data/lib/vedeu/editor/insert.rb +2 -6
- data/lib/vedeu/editor/line.rb +3 -8
- data/lib/vedeu/editor/lines.rb +1 -12
- data/lib/vedeu/events/event.rb +52 -43
- data/lib/vedeu/events/trigger.rb +7 -15
- data/lib/vedeu/geometry/generic_coordinate.rb +4 -12
- data/lib/vedeu/geometry/geometry.rb +1 -1
- data/lib/vedeu/input/translator.rb +50 -31
- data/lib/vedeu/models/focus.rb +33 -22
- data/lib/vedeu/models/group.rb +8 -7
- data/lib/vedeu/models/interface.rb +6 -10
- data/lib/vedeu/models/toggleable.rb +6 -9
- data/lib/vedeu/models/views/char.rb +24 -30
- data/lib/vedeu/models/views/html_char.rb +0 -33
- data/lib/vedeu/models/views/stream.rb +8 -7
- data/lib/vedeu/models/views/view.rb +9 -9
- data/lib/vedeu/options.rb +1 -1
- data/lib/vedeu/output/clear/all.rb +13 -0
- data/lib/vedeu/output/clear/{named_group.rb → group.rb} +4 -7
- data/lib/vedeu/output/clear/{named_interface.rb → interface.rb} +4 -7
- data/lib/vedeu/output/direct.rb +2 -2
- data/lib/vedeu/output/presentation/presentation.rb +10 -7
- data/lib/vedeu/output/renderers/all.rb +9 -4
- data/lib/vedeu/output/renderers/escape_sequence.rb +1 -1
- data/lib/vedeu/output/renderers/file.rb +1 -1
- data/lib/vedeu/output/renderers/null.rb +1 -1
- data/lib/vedeu/output/renderers/{renderer_options.rb → options.rb} +2 -2
- data/lib/vedeu/output/renderers/terminal.rb +1 -1
- data/lib/vedeu/output/renderers/text.rb +1 -1
- data/lib/vedeu/output/text.rb +4 -8
- data/lib/vedeu/output/viewport.rb +2 -6
- data/lib/vedeu/output/wordwrap.rb +2 -6
- data/lib/vedeu/repositories/repository.rb +9 -22
- data/lib/vedeu/runtime/application.rb +2 -6
- data/lib/vedeu/templating/view_template.rb +7 -15
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/bindings/bindings_test.rb +32 -6
- data/test/lib/vedeu/bindings/refresh_test.rb +1 -0
- data/test/lib/vedeu/bindings/visibility_test.rb +1 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +2 -2
- data/test/lib/vedeu/colours/background_test.rb +0 -18
- data/test/lib/vedeu/colours/foreground_test.rb +0 -18
- data/test/lib/vedeu/cursors/refresh_test.rb +5 -3
- data/test/lib/vedeu/events/aliases_test.rb +0 -6
- data/test/lib/vedeu/models/views/view_test.rb +1 -1
- data/test/lib/vedeu/output/clear/{named_group_test.rb → group_test.rb} +5 -5
- data/test/lib/vedeu/output/clear/{named_interface_test.rb → interface_test.rb} +4 -4
- data/test/lib/vedeu/output/renderers/{renderer_options_test.rb → options_test.rb} +2 -2
- data/vedeu.gemspec +1 -1
- metadata +14 -14
- data/config/rubocop_disabled.yml +0 -50
@@ -28,13 +28,9 @@ module Vedeu
|
|
28
28
|
#
|
29
29
|
# @return [Fixnum]
|
30
30
|
def dn
|
31
|
-
if d_dn <= 0
|
32
|
-
0
|
31
|
+
return 0 if d_dn <= 0
|
33
32
|
|
34
|
-
|
35
|
-
d + d_dn
|
36
|
-
|
37
|
-
end
|
33
|
+
d + d_dn
|
38
34
|
end
|
39
35
|
alias_method :xn, :dn
|
40
36
|
alias_method :yn, :dn
|
@@ -137,13 +133,9 @@ module Vedeu
|
|
137
133
|
#
|
138
134
|
# @return [Fixnum]
|
139
135
|
def dn_index
|
140
|
-
if d_dn < 1
|
141
|
-
0
|
136
|
+
return 0 if d_dn < 1
|
142
137
|
|
143
|
-
|
144
|
-
d_dn - 1
|
145
|
-
|
146
|
-
end
|
138
|
+
d_dn - 1
|
147
139
|
end
|
148
140
|
|
149
141
|
# Returns an array with all coordinates from d to dn.
|
@@ -36,7 +36,11 @@ module Vedeu
|
|
36
36
|
|
37
37
|
# @return [Hash<String => Symbol>]
|
38
38
|
def symbols
|
39
|
-
@symbols ||=
|
39
|
+
@symbols ||= ctrl_letters.merge!(f_keys)
|
40
|
+
.merge!(shift_f_keys)
|
41
|
+
.merge!(ctrl_f_keys)
|
42
|
+
.merge!(direction_keys)
|
43
|
+
.merge!(specials)
|
40
44
|
end
|
41
45
|
|
42
46
|
# @return [Hash<String => Symbol>]
|
@@ -44,10 +48,13 @@ module Vedeu
|
|
44
48
|
{
|
45
49
|
"\u0001" => :ctrl_a,
|
46
50
|
"\u0002" => :ctrl_b,
|
51
|
+
|
47
52
|
"\u0003" => :ctrl_c,
|
48
53
|
"\u2404" => :ctrl_c,
|
54
|
+
|
49
55
|
"\u0004" => :ctrl_d,
|
50
56
|
"\u2403" => :ctrl_d,
|
57
|
+
|
51
58
|
"\u0005" => :ctrl_e,
|
52
59
|
"\u0006" => :ctrl_f,
|
53
60
|
"\u0007" => :ctrl_g,
|
@@ -61,8 +68,10 @@ module Vedeu
|
|
61
68
|
"\u0015" => :ctrl_o,
|
62
69
|
"\u0016" => :ctrl_p,
|
63
70
|
"\u0017" => :ctrl_q,
|
71
|
+
|
64
72
|
"\u0018" => :ctrl_r,
|
65
73
|
"\u2412" => :ctrl_r,
|
74
|
+
|
66
75
|
"\u0019" => :ctrl_s,
|
67
76
|
# "\u0020" => :ctrl_t, # duplicates spacebar
|
68
77
|
"\u0021" => :ctrl_u,
|
@@ -81,41 +90,59 @@ module Vedeu
|
|
81
90
|
"\eOQ" => :f2,
|
82
91
|
"\eOR" => :f3,
|
83
92
|
"\eOS" => :f4,
|
84
|
-
|
85
93
|
"\e[15~" => :f5,
|
86
|
-
"\e[15;2~" => :shift_f5,
|
87
|
-
"\e[15;5~" => :ctrl_f5,
|
88
|
-
|
89
94
|
"\e[17~" => :f6,
|
90
|
-
"\e[17;2~" => :shift_f6,
|
91
|
-
"\e[17;5~" => :ctrl_f6,
|
92
|
-
|
93
95
|
"\e[18~" => :f7,
|
94
|
-
"\e[18;2~" => :shift_f7,
|
95
|
-
"\e[18;5~" => :ctrl_f7,
|
96
|
-
|
97
96
|
"\e[19~" => :f8,
|
98
|
-
"\e[19;2~" => :shift_f8,
|
99
|
-
"\e[19;5~" => :ctrl_f8,
|
100
|
-
|
101
97
|
"\e[20~" => :f9,
|
102
|
-
"\e[20;2~" => :shift_f9,
|
103
|
-
"\e[20;5~" => :ctrl_f9,
|
104
|
-
|
105
98
|
"\e[21~" => :f10,
|
106
|
-
"\e[21;2~" => :shift_f10,
|
107
|
-
"\e[21;5~" => :ctrl_f10,
|
108
|
-
|
109
99
|
"\e[23~" => :f11,
|
110
|
-
"\e[23;2~" => :shift_f11,
|
111
|
-
"\e[23;5~" => :ctrl_f11,
|
112
|
-
|
113
100
|
"\e[24~" => :f12,
|
101
|
+
}
|
102
|
+
end
|
103
|
+
|
104
|
+
# @return [Hash<String => Symbol>]
|
105
|
+
def shift_f_keys
|
106
|
+
{
|
107
|
+
"\e[15;2~" => :shift_f5,
|
108
|
+
"\e[17;2~" => :shift_f6,
|
109
|
+
"\e[18;2~" => :shift_f7,
|
110
|
+
"\e[19;2~" => :shift_f8,
|
111
|
+
"\e[20;2~" => :shift_f9,
|
112
|
+
"\e[21;2~" => :shift_f10,
|
113
|
+
"\e[23;2~" => :shift_f11,
|
114
114
|
"\e[24;2~" => :shift_f12,
|
115
|
+
}
|
116
|
+
end
|
117
|
+
|
118
|
+
# @return [Hash<String => Symbol>]
|
119
|
+
def ctrl_f_keys
|
120
|
+
{
|
121
|
+
"\e[15;5~" => :ctrl_f5,
|
122
|
+
"\e[17;5~" => :ctrl_f6,
|
123
|
+
"\e[18;5~" => :ctrl_f7,
|
124
|
+
"\e[19;5~" => :ctrl_f8,
|
125
|
+
"\e[20;5~" => :ctrl_f9,
|
126
|
+
"\e[21;5~" => :ctrl_f10,
|
127
|
+
"\e[23;5~" => :ctrl_f11,
|
115
128
|
"\e[24;5~" => :ctrl_f12,
|
116
129
|
}
|
117
130
|
end
|
118
131
|
|
132
|
+
# @return [Hash<String => Symbol>]
|
133
|
+
def direction_keys
|
134
|
+
{
|
135
|
+
"\e[B" => :down,
|
136
|
+
"\u2193" => :down,
|
137
|
+
"\e[D" => :left,
|
138
|
+
"\u2190" => :left,
|
139
|
+
"\e[C" => :right,
|
140
|
+
"\u2192" => :right,
|
141
|
+
"\e[A" => :up,
|
142
|
+
"\u2191" => :up,
|
143
|
+
}
|
144
|
+
end
|
145
|
+
|
119
146
|
# @return [Hash<String => Symbol>]
|
120
147
|
def specials
|
121
148
|
{
|
@@ -124,8 +151,6 @@ module Vedeu
|
|
124
151
|
"\u23CE" => :carriage_return,
|
125
152
|
"\e[3~" => :delete,
|
126
153
|
"\u232B" => :delete,
|
127
|
-
"\e[B" => :down,
|
128
|
-
"\u2193" => :down,
|
129
154
|
"\e[F" => :end,
|
130
155
|
"\r" => :enter,
|
131
156
|
"\n" => :enter,
|
@@ -134,21 +159,15 @@ module Vedeu
|
|
134
159
|
"\e[H" => :home,
|
135
160
|
"\eOH" => :home,
|
136
161
|
"\e[2~" => :insert,
|
137
|
-
"\e[D" => :left,
|
138
|
-
"\u2190" => :left,
|
139
162
|
"\u240A" => :line_feed,
|
140
163
|
"\e[5~" => :page_up,
|
141
164
|
"\e[6~" => :page_down,
|
142
165
|
"\e[1;2R" => :pause_break,
|
143
166
|
"\e[1;2P" => :print_screen,
|
144
|
-
"\e[C" => :right,
|
145
|
-
"\u2192" => :right,
|
146
167
|
"\e[1;2Q" => :scroll_lock,
|
147
168
|
"\e[Z" => :shift_tab,
|
148
169
|
"\t" => :tab,
|
149
170
|
"\u21B9" => :tab,
|
150
|
-
"\e[A" => :up,
|
151
|
-
"\u2191" => :up,
|
152
171
|
}
|
153
172
|
end
|
154
173
|
|
data/lib/vedeu/models/focus.rb
CHANGED
@@ -7,23 +7,26 @@ module Vedeu
|
|
7
7
|
# is currently being focussed.
|
8
8
|
#
|
9
9
|
# @note
|
10
|
-
# - Interfaces are added to the collection in the order they are
|
10
|
+
# - Interfaces are added to the collection in the order they are
|
11
|
+
# defined.
|
11
12
|
# - If the interface definition contains `focus!`,
|
12
|
-
# (see Vedeu::DSL::Interface#focus!) then that interface is
|
13
|
-
# the list.
|
14
|
-
# - If the `Vedeu.focus_by_name 'some_interface'` declaration is
|
15
|
-
# then the list pointer (`current`) is set to the
|
16
|
-
# that name.
|
13
|
+
# (see Vedeu::DSL::Interface#focus!) then that interface is
|
14
|
+
# prepended to the list.
|
15
|
+
# - If the `Vedeu.focus_by_name 'some_interface'` declaration is
|
16
|
+
# used, then the list pointer (`current`) is set to the
|
17
|
+
# interface of that name.
|
17
18
|
#
|
18
19
|
module Focus
|
19
20
|
|
20
21
|
extend self
|
21
22
|
|
22
|
-
# Add an interface name to the focus list unless it is already
|
23
|
+
# Add an interface name to the focus list unless it is already
|
24
|
+
# registered.
|
23
25
|
#
|
24
26
|
# @param name [String] The name of the interface.
|
25
|
-
# @param focus [Boolean] When true, prepends the interface name
|
26
|
-
# collection, making that interface the currently
|
27
|
+
# @param focus [Boolean] When true, prepends the interface name
|
28
|
+
# to the collection, making that interface the currently
|
29
|
+
# focussed interface.
|
27
30
|
# @return [Array] The collection of interface names.
|
28
31
|
def add(name, focus = false)
|
29
32
|
if registered?(name)
|
@@ -53,7 +56,8 @@ module Vedeu
|
|
53
56
|
# Vedeu.focus_by_name('name')
|
54
57
|
#
|
55
58
|
# @param name [String] The interface to focus; must be defined.
|
56
|
-
# @raise [Vedeu::Error::ModelNotFound] When the interface cannot
|
59
|
+
# @raise [Vedeu::Error::ModelNotFound] When the interface cannot
|
60
|
+
# be found.
|
57
61
|
# @return [String] The name of the interface now in focus.
|
58
62
|
def by_name(name)
|
59
63
|
unless registered?(name)
|
@@ -79,7 +83,8 @@ module Vedeu
|
|
79
83
|
end
|
80
84
|
alias_method :focus, :current
|
81
85
|
|
82
|
-
# Returns a boolean indicating whether the named interface is
|
86
|
+
# Returns a boolean indicating whether the named interface is
|
87
|
+
# focussed.
|
83
88
|
#
|
84
89
|
# @example
|
85
90
|
# Vedeu.focussed?(name)
|
@@ -98,7 +103,8 @@ module Vedeu
|
|
98
103
|
storage.empty?
|
99
104
|
end
|
100
105
|
|
101
|
-
# Put the next interface relative to the current interfaces in
|
106
|
+
# Put the next interface relative to the current interfaces in
|
107
|
+
# focus.
|
102
108
|
#
|
103
109
|
# @example
|
104
110
|
# Vedeu.trigger(:_focus_next_)
|
@@ -112,8 +118,8 @@ module Vedeu
|
|
112
118
|
end
|
113
119
|
alias_method :next, :next_item
|
114
120
|
|
115
|
-
# Put the next visible interface relative to the current
|
116
|
-
# focus.
|
121
|
+
# Put the next visible interface relative to the current
|
122
|
+
# interfaces in focus.
|
117
123
|
#
|
118
124
|
# @return [String]
|
119
125
|
def next_visible_item
|
@@ -128,7 +134,8 @@ module Vedeu
|
|
128
134
|
end
|
129
135
|
alias_method :focus_next, :next_visible_item
|
130
136
|
|
131
|
-
# Put the previous interface relative to the current interface
|
137
|
+
# Put the previous interface relative to the current interface
|
138
|
+
# in focus.
|
132
139
|
#
|
133
140
|
# @example
|
134
141
|
# Vedeu.trigger(:_focus_prev_)
|
@@ -143,8 +150,8 @@ module Vedeu
|
|
143
150
|
alias_method :prev, :prev_item
|
144
151
|
alias_method :previous, :prev_item
|
145
152
|
|
146
|
-
# Put the previous visible interface relative to the current
|
147
|
-
# focus.
|
153
|
+
# Put the previous visible interface relative to the current
|
154
|
+
# interfaces in focus.
|
148
155
|
#
|
149
156
|
# @return [String]
|
150
157
|
def prev_visible_item
|
@@ -166,7 +173,8 @@ module Vedeu
|
|
166
173
|
Vedeu.trigger(:_refresh_, current)
|
167
174
|
end
|
168
175
|
|
169
|
-
# Returns a collection of the names of all the registered
|
176
|
+
# Returns a collection of the names of all the registered
|
177
|
+
# entities.
|
170
178
|
#
|
171
179
|
# @return [Array]
|
172
180
|
def registered
|
@@ -175,7 +183,8 @@ module Vedeu
|
|
175
183
|
storage
|
176
184
|
end
|
177
185
|
|
178
|
-
# Returns a boolean indicating whether the named model is
|
186
|
+
# Returns a boolean indicating whether the named model is
|
187
|
+
# registered.
|
179
188
|
#
|
180
189
|
# @param name [String]
|
181
190
|
# @return [Boolean]
|
@@ -194,8 +203,9 @@ module Vedeu
|
|
194
203
|
|
195
204
|
private
|
196
205
|
|
197
|
-
# Return the name of the interface in focus after triggering the
|
198
|
-
# event for that interface. Returns false when the
|
206
|
+
# Return the name of the interface in focus after triggering the
|
207
|
+
# refresh event for that interface. Returns false when the
|
208
|
+
# storage is empty.
|
199
209
|
#
|
200
210
|
# @return [String|FalseClass]
|
201
211
|
def update
|
@@ -215,7 +225,8 @@ module Vedeu
|
|
215
225
|
@storage ||= in_memory
|
216
226
|
end
|
217
227
|
|
218
|
-
# Returns an empty collection ready for the storing of interface
|
228
|
+
# Returns an empty collection ready for the storing of interface
|
229
|
+
# names.
|
219
230
|
#
|
220
231
|
# @return [Array]
|
221
232
|
def in_memory
|
data/lib/vedeu/models/group.rb
CHANGED
@@ -68,13 +68,14 @@ module Vedeu
|
|
68
68
|
interfaces.sort { |a, b| a.zindex <=> b.zindex }.map(&:name)
|
69
69
|
end
|
70
70
|
|
71
|
-
# Hide the named group of interfaces, or without a name, the
|
72
|
-
# currently focussed interface. Useful for hiding
|
73
|
-
# currently displaying in the terminal.
|
71
|
+
# Hide the named group of interfaces, or without a name, the
|
72
|
+
# group of the currently focussed interface. Useful for hiding
|
73
|
+
# part of that which is currently displaying in the terminal.
|
74
74
|
#
|
75
75
|
# @note
|
76
|
-
# The action of showing a group will effectively clear the
|
77
|
-
# show the new group, therefore hiding the group
|
76
|
+
# The action of showing a group will effectively clear the
|
77
|
+
# terminal and show the new group, therefore hiding the group
|
78
|
+
# may not be necessary.
|
78
79
|
#
|
79
80
|
# @example
|
80
81
|
# Vedeu.trigger(:_hide_group_, name)
|
@@ -117,8 +118,8 @@ module Vedeu
|
|
117
118
|
Vedeu::Models::Group.new(attrs).store
|
118
119
|
end
|
119
120
|
|
120
|
-
# Show the named group of interfaces, or without a name, the
|
121
|
-
# currently focussed interface.
|
121
|
+
# Show the named group of interfaces, or without a name, the
|
122
|
+
# group of the currently focussed interface.
|
122
123
|
#
|
123
124
|
# @example
|
124
125
|
# Vedeu.trigger(:_show_group_, name)
|
@@ -61,8 +61,8 @@ module Vedeu
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
# Hide a named interface buffer, or without a name, the buffer
|
65
|
-
# currently focussed interface.
|
64
|
+
# Hide a named interface buffer, or without a name, the buffer
|
65
|
+
# of the currently focussed interface.
|
66
66
|
#
|
67
67
|
# @example
|
68
68
|
# Vedeu.hide_interface(name)
|
@@ -74,8 +74,8 @@ module Vedeu
|
|
74
74
|
Vedeu.buffers.by_name(name).hide
|
75
75
|
end
|
76
76
|
|
77
|
-
# Show the named interface buffer, or without a name, the buffer
|
78
|
-
# currently focussed interface.
|
77
|
+
# Show the named interface buffer, or without a name, the buffer
|
78
|
+
# of the currently focussed interface.
|
79
79
|
#
|
80
80
|
# @example
|
81
81
|
# Vedeu.show_interface(name)
|
@@ -94,13 +94,9 @@ module Vedeu
|
|
94
94
|
#
|
95
95
|
# @return [void]
|
96
96
|
def toggle
|
97
|
-
if visible?
|
98
|
-
hide
|
97
|
+
return hide if visible?
|
99
98
|
|
100
|
-
|
101
|
-
show
|
102
|
-
|
103
|
-
end
|
99
|
+
show
|
104
100
|
end
|
105
101
|
|
106
102
|
private
|
@@ -36,16 +36,13 @@ module Vedeu
|
|
36
36
|
#
|
37
37
|
# @return [FalseClass|TrueClass]
|
38
38
|
def toggle
|
39
|
-
if visible?
|
40
|
-
hide
|
39
|
+
return hide if visible?
|
41
40
|
|
42
|
-
|
43
|
-
show
|
44
|
-
|
45
|
-
end
|
41
|
+
show
|
46
42
|
end
|
47
43
|
|
48
|
-
# Provide class methods to models to allow the visibility to be
|
44
|
+
# Provide class methods to models to allow the visibility to be
|
45
|
+
# changed.
|
49
46
|
#
|
50
47
|
module ClassMethods
|
51
48
|
|
@@ -95,8 +92,8 @@ module Vedeu
|
|
95
92
|
|
96
93
|
end # ClassMethods
|
97
94
|
|
98
|
-
# When this module is included in a class, provide ClassMethods as
|
99
|
-
# methods for the class.
|
95
|
+
# When this module is included in a class, provide ClassMethods as
|
96
|
+
# class methods for the class.
|
100
97
|
#
|
101
98
|
# @param klass [Class]
|
102
99
|
# @return [void]
|
@@ -9,11 +9,12 @@ module Vedeu
|
|
9
9
|
|
10
10
|
end # Chars
|
11
11
|
|
12
|
-
# A Char represents a single character of the terminal. It is a
|
13
|
-
# for the a single character in a
|
12
|
+
# A Char represents a single character of the terminal. It is a
|
13
|
+
# container for the a single character in a
|
14
|
+
# {Vedeu::Views::Stream}.
|
14
15
|
#
|
15
|
-
# Though a multi-character String can be passed as a value, only
|
16
|
-
# character is returned in the escape sequence.
|
16
|
+
# Though a multi-character String can be passed as a value, only
|
17
|
+
# the first character is returned in the escape sequence.
|
17
18
|
#
|
18
19
|
class Char
|
19
20
|
|
@@ -39,8 +40,9 @@ module Vedeu
|
|
39
40
|
# Returns a new instance of Vedeu::Views::Char.
|
40
41
|
#
|
41
42
|
# @param attributes [Hash]
|
42
|
-
# @option attributes border [NilClass|Symbol]
|
43
|
-
# border 'piece' this
|
43
|
+
# @option attributes border [NilClass|Symbol]
|
44
|
+
# A symbol representing the border 'piece' this
|
45
|
+
# {Vedeu::Views::Char} represents.
|
44
46
|
# @option attributes colour [Vedeu::Colours::Colour]
|
45
47
|
# @option attributes parent [Vedeu::Views::Line]
|
46
48
|
# @option attributes position [Vedeu::Geometry::Position]
|
@@ -54,11 +56,11 @@ module Vedeu
|
|
54
56
|
@value = @attributes[:value]
|
55
57
|
end
|
56
58
|
|
57
|
-
# When {Vedeu::Output::Viewport#show} has less lines that
|
58
|
-
# the visible area of the interface, it creates
|
59
|
-
# single {Vedeu::Views::Char} containing
|
60
|
-
# to call `#chars` on an
|
61
|
-
# method fixes that.
|
59
|
+
# When {Vedeu::Output::Viewport#show} has less lines that
|
60
|
+
# required to fill the visible area of the interface, it creates
|
61
|
+
# a line that contains a single {Vedeu::Views::Char} containing
|
62
|
+
# a space (0x20); later, attempts to call `#chars` on an
|
63
|
+
# expected {Vedeu::Views::Line} and fail; this method fixes that.
|
62
64
|
#
|
63
65
|
# @return [Array]
|
64
66
|
def chars
|
@@ -91,13 +93,9 @@ module Vedeu
|
|
91
93
|
|
92
94
|
# @return [String]
|
93
95
|
def value
|
94
|
-
|
95
|
-
Vedeu::EscapeSequences::Esc.border { @value }
|
96
|
+
return @value unless border
|
96
97
|
|
97
|
-
|
98
|
-
@value
|
99
|
-
|
100
|
-
end
|
98
|
+
Vedeu::EscapeSequences::Esc.border { @value }
|
101
99
|
end
|
102
100
|
|
103
101
|
# Returns the x position for the Vedeu::Views::Char when set.
|
@@ -117,9 +115,9 @@ module Vedeu
|
|
117
115
|
# Returns a Hash of all the values before coercion.
|
118
116
|
#
|
119
117
|
# @note
|
120
|
-
# From this hash we should be able to construct a new instance
|
121
|
-
# Vedeu::Views::Char, however, at the moment, `:parent`
|
122
|
-
# coerced.
|
118
|
+
# From this hash we should be able to construct a new instance
|
119
|
+
# of {Vedeu::Views::Char}, however, at the moment, `:parent`
|
120
|
+
# cannot be coerced.
|
123
121
|
#
|
124
122
|
# @return [Hash<Symbol => Hash, String>]
|
125
123
|
def to_hash
|
@@ -152,17 +150,13 @@ module Vedeu
|
|
152
150
|
|
153
151
|
# @return [Hash<Symbol => String>]
|
154
152
|
def parent_to_hash
|
155
|
-
|
156
|
-
{
|
157
|
-
background: parent.background.to_s,
|
158
|
-
foreground: parent.foreground.to_s,
|
159
|
-
style: parent.style.to_s,
|
160
|
-
}
|
161
|
-
|
162
|
-
else
|
163
|
-
{}
|
153
|
+
return {} unless parent
|
164
154
|
|
165
|
-
|
155
|
+
{
|
156
|
+
background: parent.background.to_s,
|
157
|
+
foreground: parent.foreground.to_s,
|
158
|
+
style: parent.style.to_s,
|
159
|
+
}
|
166
160
|
end
|
167
161
|
|
168
162
|
# @return [Has<Symbol => Fixnum>]
|