vedeu 0.4.40 → 0.4.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Dockerfile +23 -28
- data/Guardfile +0 -8
- data/Rakefile +0 -6
- data/docs/applications.md +0 -1
- data/docs/dsl.md +7 -12
- data/examples/borders_app.rb +5 -0
- data/examples/configuration_app.rb +5 -0
- data/examples/drb_app.rb +5 -0
- data/examples/geometry_app.rb +5 -0
- data/examples/material_colours_app.rb +5 -0
- data/examples/panel_app.rb +5 -0
- data/examples/typed_commands/typed_commands_app.rb +5 -0
- data/examples/view_templates_app/view_templates_app.rb +5 -0
- data/lib/vedeu/api.rb +8 -8
- data/lib/vedeu/application/all.rb +3 -0
- data/lib/vedeu/application/application_controller.rb +4 -0
- data/lib/vedeu/application/application_helper.rb +4 -0
- data/lib/vedeu/application/application_view.rb +6 -0
- data/lib/vedeu/application/controller.rb +23 -0
- data/lib/vedeu/application/helper.rb +23 -0
- data/lib/vedeu/application/view.rb +23 -0
- data/lib/vedeu/application.rb +1 -3
- data/lib/vedeu/bindings.rb +64 -65
- data/lib/vedeu/bootstrap.rb +2 -0
- data/lib/vedeu/buffers/buffer.rb +44 -0
- data/lib/vedeu/configuration/api.rb +44 -119
- data/lib/vedeu/configuration/cli.rb +2 -0
- data/lib/vedeu/configuration/configuration.rb +4 -20
- data/lib/vedeu/cursor/cursor.rb +7 -7
- data/lib/vedeu/cursor/reposition.rb +2 -0
- data/lib/vedeu/dsl/border.rb +58 -2
- data/lib/vedeu/dsl/composition.rb +5 -3
- data/lib/vedeu/dsl/geometry.rb +14 -5
- data/lib/vedeu/dsl/group.rb +2 -0
- data/lib/vedeu/dsl/interface.rb +23 -3
- data/lib/vedeu/dsl/keymap.rb +11 -6
- data/lib/vedeu/dsl/line.rb +8 -0
- data/lib/vedeu/dsl/menu.rb +3 -1
- data/lib/vedeu/dsl/presentation.rb +12 -3
- data/lib/vedeu/dsl/text.rb +2 -0
- data/lib/vedeu/dsl/view.rb +6 -1
- data/lib/vedeu/events/event.rb +3 -1
- data/lib/vedeu/generator/application.rb +2 -7
- data/lib/vedeu/generator/templates/application/app/models/keymaps/_global_.rb +5 -0
- data/lib/vedeu/generator/templates/application/app/views/interfaces/name.erb +10 -0
- data/lib/vedeu/generator/view.rb +2 -0
- data/lib/vedeu/geometry/geometry.rb +14 -0
- data/lib/vedeu/geometry/index_position.rb +1 -0
- data/lib/vedeu/geometry/position.rb +5 -0
- data/lib/vedeu/input/all.rb +0 -8
- data/lib/vedeu/input/input.rb +24 -8
- data/lib/vedeu/input/mapper.rb +5 -12
- data/lib/vedeu/models/composition.rb +3 -3
- data/lib/vedeu/models/escape_char.rb +2 -0
- data/lib/vedeu/models/focus.rb +8 -0
- data/lib/vedeu/models/interface.rb +1 -1
- data/lib/vedeu/models/line.rb +1 -5
- data/lib/vedeu/models/menu.rb +4 -2
- data/lib/vedeu/models/panel.rb +2 -0
- data/lib/vedeu/null/buffer.rb +2 -0
- data/lib/vedeu/null/interface.rb +2 -0
- data/lib/vedeu/output/background.rb +1 -1
- data/lib/vedeu/output/border.rb +5 -157
- data/lib/vedeu/output/compressor.rb +2 -0
- data/lib/vedeu/output/foreground.rb +1 -1
- data/lib/vedeu/output/refresh.rb +5 -9
- data/lib/vedeu/output/render_border.rb +230 -0
- data/lib/vedeu/output/renderers/escape_sequence.rb +2 -3
- data/lib/vedeu/output/renderers/file.rb +10 -9
- data/lib/vedeu/repositories/collections/all.rb +4 -4
- data/lib/vedeu/repositories/repositories/all.rb +4 -4
- data/lib/vedeu/repositories/repositories/{background_colours.rb → backgrounds.rb} +3 -3
- data/lib/vedeu/repositories/repositories/cursors.rb +3 -0
- data/lib/vedeu/repositories/repositories/{events_repository.rb → events.rb} +5 -5
- data/lib/vedeu/repositories/repositories/{foreground_colours.rb → foregrounds.rb} +3 -3
- data/lib/vedeu/repositories/repositories/{interfaces_repository.rb → interfaces.rb} +4 -4
- data/lib/vedeu/storage/associative_store.rb +2 -0
- data/lib/vedeu/storage/conveyor_store.rb +2 -0
- data/lib/vedeu/storage/fifo_store.rb +2 -0
- data/lib/vedeu/storage/store.rb +7 -7
- data/lib/vedeu/support/options.rb +2 -0
- data/lib/vedeu/support/terminal.rb +3 -3
- data/lib/vedeu/support/timer.rb +2 -0
- data/lib/vedeu/support/visibility.rb +2 -0
- data/lib/vedeu/templating/directive.rb +2 -0
- data/lib/vedeu/templating/preprocessor.rb +2 -0
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu.rb +3 -1
- data/test/lib/vedeu/bindings_test.rb +15 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +12 -0
- data/test/lib/vedeu/configuration/api_test.rb +0 -39
- data/test/lib/vedeu/configuration/configuration_test.rb +0 -9
- data/test/lib/vedeu/cursor/cursor_test.rb +6 -0
- data/test/lib/vedeu/dsl/border_test.rb +12 -0
- data/test/lib/vedeu/dsl/composition_test.rb +2 -2
- data/test/lib/vedeu/geometry/index_position_test.rb +2 -0
- data/test/lib/vedeu/geometry/position_test.rb +6 -0
- data/test/lib/vedeu/models/cell_test.rb +16 -8
- data/test/lib/vedeu/models/char_test.rb +8 -0
- data/test/lib/vedeu/models/composition_test.rb +2 -2
- data/test/lib/vedeu/models/interface_test.rb +10 -0
- data/test/lib/vedeu/models/line_test.rb +12 -0
- data/test/lib/vedeu/models/stream_test.rb +1 -13
- data/test/lib/vedeu/output/border_test.rb +1 -0
- data/test/lib/vedeu/output/presentation_test.rb +2 -0
- data/test/lib/vedeu/output/render_border_test.rb +16 -0
- data/test/lib/vedeu/output/renderers/file_test.rb +32 -16
- data/test/lib/vedeu/repositories/collection_test.rb +7 -0
- data/test/lib/vedeu/repositories/collections/all_test.rb +18 -6
- data/test/lib/vedeu/repositories/model_test.rb +33 -7
- data/test/lib/vedeu/repositories/repositories/{background_colours_test.rb → backgrounds_test.rb} +3 -3
- data/test/lib/vedeu/repositories/repositories/borders_test.rb +7 -17
- data/test/lib/vedeu/repositories/repositories/buffers_test.rb +7 -22
- data/test/lib/vedeu/repositories/repositories/cursors_test.rb +32 -0
- data/test/lib/vedeu/repositories/repositories/events_test.rb +22 -0
- data/test/lib/vedeu/repositories/repositories/{foreground_colours_test.rb → foregrounds_test.rb} +3 -3
- data/test/lib/vedeu/repositories/repositories/geometries_test.rb +7 -21
- data/test/lib/vedeu/repositories/repositories/groups_test.rb +11 -0
- data/test/lib/vedeu/repositories/repositories/{interfaces_repositories_test.rb → interfaces_test.rb} +14 -3
- data/test/lib/vedeu/repositories/repositories/keymaps_test.rb +10 -1
- data/test/lib/vedeu/repositories/repositories/menus_test.rb +10 -1
- data/test/lib/vedeu/repositories/repository_test.rb +15 -9
- data/test/lib/vedeu/storage/conveyor_store_test.rb +2 -4
- data/test/lib/vedeu/support/terminal_test.rb +2 -2
- data/test/lib/vedeu/templating/helpers_test.rb +4 -0
- data/vedeu.gemspec +0 -2
- metadata +20 -54
- data/config/cucumber.yml +0 -8
- data/features/cli_vedeu.feature +0 -5
- data/features/start_stop.feature +0 -27
- data/features/step_definitions/vedeu_steps.rb +0 -0
- data/features/support/env.rb +0 -15
- data/lib/vedeu/generator/templates/application/app/models/keymaps/_system_.rb +0 -7
- data/test/lib/vedeu/repositories/repositories/events_repository_test.rb +0 -13
- data/test/lib/vedeu/repositories/repositories/interfaces_repository_test.rb +0 -11
|
@@ -75,6 +75,11 @@ module Vedeu
|
|
|
75
75
|
[y, x]
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
+
# @return [Vedeu::Position]
|
|
79
|
+
def to_position
|
|
80
|
+
self
|
|
81
|
+
end
|
|
82
|
+
|
|
78
83
|
# Return the escape sequence required to position the cursor at a particular
|
|
79
84
|
# point on the screen. When passed a block, will do the aforementioned,
|
|
80
85
|
# call the block and then reposition to this location.
|
data/lib/vedeu/input/all.rb
CHANGED
|
@@ -5,14 +5,6 @@ require_relative 'keymap'
|
|
|
5
5
|
|
|
6
6
|
module Vedeu
|
|
7
7
|
|
|
8
|
-
# Define a keymap called '_system_' which will hold some vital keys needed by
|
|
9
|
-
# Vedeu to run effectively.
|
|
10
|
-
Vedeu::DSL::Keymap.keymap('_system_') do |keymap|
|
|
11
|
-
Vedeu::Configuration.system_keys.each do |label, keypress|
|
|
12
|
-
keymap.key(keypress) { Vedeu.trigger(("_#{label}_").to_sym) }
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
8
|
# Define a keymap called '_global_' which will respond no matter which
|
|
17
9
|
# interface is in focus.
|
|
18
10
|
#
|
data/lib/vedeu/input/input.rb
CHANGED
|
@@ -86,14 +86,30 @@ module Vedeu
|
|
|
86
86
|
"\eOQ" => :f2,
|
|
87
87
|
"\eOR" => :f3,
|
|
88
88
|
"\eOS" => :f4,
|
|
89
|
-
"\e[15~"
|
|
90
|
-
"\e[
|
|
91
|
-
"\e[
|
|
92
|
-
"\e[
|
|
93
|
-
"\e[
|
|
94
|
-
"\e[
|
|
95
|
-
"\e[
|
|
96
|
-
"\e[
|
|
89
|
+
"\e[15~" => :f5,
|
|
90
|
+
"\e[15;2~" => :shift_f5,
|
|
91
|
+
"\e[15;5~" => :ctrl_f5,
|
|
92
|
+
"\e[17~" => :f6,
|
|
93
|
+
"\e[17;2~" => :shift_f6,
|
|
94
|
+
"\e[17;5~" => :ctrl_f6,
|
|
95
|
+
"\e[18~" => :f7,
|
|
96
|
+
"\e[18;2~" => :shift_f7,
|
|
97
|
+
"\e[18;5~" => :ctrl_f6,
|
|
98
|
+
"\e[19~" => :f8,
|
|
99
|
+
"\e[19;2~" => :shift_f8,
|
|
100
|
+
"\e[19;5~" => :ctrl_f6,
|
|
101
|
+
"\e[20~" => :f9,
|
|
102
|
+
"\e[20;2~" => :shift_f9,
|
|
103
|
+
"\e[20;5~" => :ctrl_f6,
|
|
104
|
+
"\e[21~" => :f10,
|
|
105
|
+
"\e[21;2~" => :shift_f10,
|
|
106
|
+
"\e[21;5~" => :ctrl_f6,
|
|
107
|
+
"\e[23~" => :f11,
|
|
108
|
+
"\e[23;2~" => :shift_f11,
|
|
109
|
+
"\e[23;5~" => :ctrl_f6,
|
|
110
|
+
"\e[24~" => :f12,
|
|
111
|
+
"\e[24;2~" => :shift_f12,
|
|
112
|
+
"\e[24;5~" => :ctrl_f6,
|
|
97
113
|
"\e[1;2P" => :print_screen,
|
|
98
114
|
"\e[1;2Q" => :scroll_lock,
|
|
99
115
|
"\e[1;2R" => :pause_break,
|
data/lib/vedeu/input/mapper.rb
CHANGED
|
@@ -46,27 +46,27 @@ module Vedeu
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
# Returns a boolean indicating that the key is registered to the current
|
|
49
|
-
# keymap or the global
|
|
49
|
+
# keymap, or the global keymap.
|
|
50
50
|
#
|
|
51
51
|
# @return [Boolean]
|
|
52
52
|
def keypress
|
|
53
53
|
return false unless key
|
|
54
54
|
|
|
55
|
+
Vedeu.log(type: :debug, message: "Key detected: #{key.inspect}")
|
|
56
|
+
|
|
55
57
|
return true if key_defined? && keymap.use(key)
|
|
56
58
|
|
|
57
59
|
return true if global_key? && keymap('_global_').use(key)
|
|
58
60
|
|
|
59
|
-
return true if system_key? && keymap('_system_').use(key)
|
|
60
|
-
|
|
61
61
|
false
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
# Returns a boolean indicating that the key is not registered to the current
|
|
65
|
-
# keymap,
|
|
65
|
+
# keymap, or the global keymap.
|
|
66
66
|
#
|
|
67
67
|
# @return [Boolean]
|
|
68
68
|
def valid?
|
|
69
|
-
return false if !key || key_defined? || global_key?
|
|
69
|
+
return false if !key || key_defined? || global_key?
|
|
70
70
|
|
|
71
71
|
true
|
|
72
72
|
end
|
|
@@ -90,13 +90,6 @@ module Vedeu
|
|
|
90
90
|
key_defined?('_global_')
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
# Is the key a system key?
|
|
94
|
-
#
|
|
95
|
-
# @return [Boolean]
|
|
96
|
-
def system_key?
|
|
97
|
-
key_defined?('_system_')
|
|
98
|
-
end
|
|
99
|
-
|
|
100
93
|
# Is the key defined in the named keymap?
|
|
101
94
|
#
|
|
102
95
|
# @param named [NilClass|String]
|
|
@@ -8,7 +8,7 @@ module Vedeu
|
|
|
8
8
|
include Vedeu::Model
|
|
9
9
|
include Vedeu::Presentation
|
|
10
10
|
|
|
11
|
-
collection Vedeu::
|
|
11
|
+
collection Vedeu::InterfaceCollection
|
|
12
12
|
member Vedeu::Interface
|
|
13
13
|
|
|
14
14
|
# @!attribute [r] attributes
|
|
@@ -29,12 +29,12 @@ module Vedeu
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
# @param child [Vedeu::Interface]
|
|
32
|
-
# @return [Vedeu::
|
|
32
|
+
# @return [Vedeu::InterfaceCollection]
|
|
33
33
|
def add(child)
|
|
34
34
|
@interfaces = interfaces.add(child)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
# @return [Vedeu::
|
|
37
|
+
# @return [Vedeu::InterfaceCollection]
|
|
38
38
|
def interfaces
|
|
39
39
|
collection.coerce(@interfaces, self)
|
|
40
40
|
end
|
data/lib/vedeu/models/focus.rb
CHANGED
|
@@ -4,6 +4,14 @@ module Vedeu
|
|
|
4
4
|
# serving to store and manipulate the which interface is currently being
|
|
5
5
|
# focussed.
|
|
6
6
|
#
|
|
7
|
+
# @note
|
|
8
|
+
# - Interfaces are added to the collection in the order they are defined.
|
|
9
|
+
# - If the interface definition contains `focus!`,
|
|
10
|
+
# (see Vedeu::DSL::Interface#focus!) then that interface is prepended to
|
|
11
|
+
# the list.
|
|
12
|
+
# - If the `Vedeu.focus_by_name 'some_interface'` declaration is used, then
|
|
13
|
+
# the list pointer (`current`) is set to the interface of that name.
|
|
14
|
+
#
|
|
7
15
|
# @api private
|
|
8
16
|
module Focus
|
|
9
17
|
|
|
@@ -65,7 +65,7 @@ module Vedeu
|
|
|
65
65
|
# @option attributes lines [Vedeu::Lines]
|
|
66
66
|
# @option attributes name [String]
|
|
67
67
|
# @option attributes parent [Vedeu::Composition]
|
|
68
|
-
# @option attributes repository [Vedeu::
|
|
68
|
+
# @option attributes repository [Vedeu::Interfaces]
|
|
69
69
|
# @option attributes style [Vedeu::Style]
|
|
70
70
|
# @option attributes visible [Boolean]
|
|
71
71
|
# @option attributes zindex [Fixnum]
|
data/lib/vedeu/models/line.rb
CHANGED
|
@@ -17,11 +17,6 @@ module Vedeu
|
|
|
17
17
|
# @return [Interface]
|
|
18
18
|
attr_accessor :parent
|
|
19
19
|
|
|
20
|
-
# @!attribute [rw] streams
|
|
21
|
-
# @return [Streams]
|
|
22
|
-
attr_accessor :streams
|
|
23
|
-
alias_method :value, :streams
|
|
24
|
-
|
|
25
20
|
# @!attribute [r] attributes
|
|
26
21
|
# @return [Hash]
|
|
27
22
|
attr_reader :attributes
|
|
@@ -79,6 +74,7 @@ module Vedeu
|
|
|
79
74
|
def streams
|
|
80
75
|
@_streams ||= collection.coerce(@streams, self)
|
|
81
76
|
end
|
|
77
|
+
alias_method :value, :streams
|
|
82
78
|
|
|
83
79
|
# Delegate to Vedeu::Interface#width if available.
|
|
84
80
|
#
|
data/lib/vedeu/models/menu.rb
CHANGED
|
@@ -41,12 +41,14 @@ module Vedeu
|
|
|
41
41
|
# @example
|
|
42
42
|
# Vedeu.menu 'my_interface' do
|
|
43
43
|
# items [:item_1, :item_2, :item_3]
|
|
44
|
-
# ...
|
|
44
|
+
# # ...
|
|
45
|
+
# end
|
|
45
46
|
#
|
|
46
47
|
# Vedeu.menu do
|
|
47
48
|
# name 'menus_must_have_a_name'
|
|
48
49
|
# items Track.all_my_favourites
|
|
49
|
-
# ...
|
|
50
|
+
# # ...
|
|
51
|
+
# end
|
|
50
52
|
#
|
|
51
53
|
# @raise [InvalidSyntax] The required block was not given.
|
|
52
54
|
# @return [API::Menu]
|
data/lib/vedeu/models/panel.rb
CHANGED
data/lib/vedeu/null/buffer.rb
CHANGED
data/lib/vedeu/null/interface.rb
CHANGED
data/lib/vedeu/output/border.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'vedeu/output/render_border'
|
|
2
|
+
|
|
1
3
|
module Vedeu
|
|
2
4
|
|
|
3
5
|
# Provides the mechanism to decorate an interface with a border on all edges,
|
|
@@ -82,7 +84,7 @@ module Vedeu
|
|
|
82
84
|
|
|
83
85
|
# @!attribute [r] enabled
|
|
84
86
|
# @return [Boolean]
|
|
85
|
-
|
|
87
|
+
attr_accessor :enabled
|
|
86
88
|
alias_method :enabled?, :enabled
|
|
87
89
|
|
|
88
90
|
# Returns a new instance of Vedeu::Border.
|
|
@@ -156,18 +158,7 @@ module Vedeu
|
|
|
156
158
|
|
|
157
159
|
# @return [Array<Array<Vedeu::Char>>]
|
|
158
160
|
def render
|
|
159
|
-
|
|
160
|
-
return [] unless enabled?
|
|
161
|
-
|
|
162
|
-
Vedeu.timer("Rendering border: #{name}") do
|
|
163
|
-
out = [top, bottom]
|
|
164
|
-
|
|
165
|
-
height.times do |y|
|
|
166
|
-
out << [left(y), right(y)]
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
out.flatten
|
|
170
|
-
end
|
|
161
|
+
@render ||= Vedeu::RenderBorder.with(self)
|
|
171
162
|
end
|
|
172
163
|
|
|
173
164
|
# @return [String]
|
|
@@ -176,152 +167,8 @@ module Vedeu
|
|
|
176
167
|
end
|
|
177
168
|
alias_method :to_str, :to_s
|
|
178
169
|
|
|
179
|
-
# Renders the bottom border for the interface.
|
|
180
|
-
#
|
|
181
|
-
# @return [String]
|
|
182
|
-
def bottom
|
|
183
|
-
return [] unless bottom?
|
|
184
|
-
|
|
185
|
-
out = []
|
|
186
|
-
out << border(bottom_left, :bottom_left, *[yn, x]) if left?
|
|
187
|
-
out << horizontal_border(:bottom_horizontal, yn)
|
|
188
|
-
out << border(bottom_right, :bottom_right, *[yn, xn]) if right?
|
|
189
|
-
out
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
# Renders the left border for the interface.
|
|
193
|
-
#
|
|
194
|
-
# @param iy [Fixnum]
|
|
195
|
-
# @return [String]
|
|
196
|
-
def left(iy = 0)
|
|
197
|
-
return [] unless left?
|
|
198
|
-
|
|
199
|
-
border(vertical, :left_vertical, *[(by + iy), x])
|
|
200
|
-
end
|
|
201
|
-
|
|
202
|
-
# Renders the right border for the interface.
|
|
203
|
-
#
|
|
204
|
-
# @param iy [Fixnum]
|
|
205
|
-
# @return [String]
|
|
206
|
-
def right(iy = 0)
|
|
207
|
-
return [] unless right?
|
|
208
|
-
|
|
209
|
-
border(vertical, :left_vertical, *[(by + iy), xn])
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
# Renders the top border for the interface.
|
|
213
|
-
#
|
|
214
|
-
# @note
|
|
215
|
-
# If a title has been specified, then the top border will include this
|
|
216
|
-
# title unless the size of the interface is smaller than the padded title
|
|
217
|
-
# length.
|
|
218
|
-
#
|
|
219
|
-
# @return [String]
|
|
220
|
-
def top
|
|
221
|
-
return [] unless top?
|
|
222
|
-
|
|
223
|
-
out = []
|
|
224
|
-
out << border(top_left, :top_left, *[y, x]) if left?
|
|
225
|
-
if title? && width > title_characters.size
|
|
226
|
-
out << titlebar
|
|
227
|
-
|
|
228
|
-
else
|
|
229
|
-
out << horizontal_border(:top_horizontal, y)
|
|
230
|
-
|
|
231
|
-
end
|
|
232
|
-
out << border(top_right, :top_right, *[y, xn]) if right?
|
|
233
|
-
out
|
|
234
|
-
end
|
|
235
|
-
|
|
236
|
-
# The parent of a border is always an interface.
|
|
237
|
-
#
|
|
238
|
-
# @return [Vedeu::Interface]
|
|
239
|
-
def parent
|
|
240
|
-
interface
|
|
241
|
-
end
|
|
242
|
-
|
|
243
170
|
private
|
|
244
171
|
|
|
245
|
-
# @param position [Symbol] Either :top_horizontal, or :bottom_horizontal.
|
|
246
|
-
# @return [Array<Vedeu::Char>]
|
|
247
|
-
def horizontal_border(position, y_coordinate)
|
|
248
|
-
width.times.each_with_object([]) do |ix, a|
|
|
249
|
-
a << border(horizontal, position, *[y_coordinate, (bx + ix)])
|
|
250
|
-
end
|
|
251
|
-
end
|
|
252
|
-
|
|
253
|
-
# From the second element of {#title_characters} remove the border from each
|
|
254
|
-
# {#horizontal_border} Vedeu::Char, and add the title character.
|
|
255
|
-
#
|
|
256
|
-
# @return [Array<Vedeu::Char>]
|
|
257
|
-
def titlebar
|
|
258
|
-
horizontal_border(:top_horizontal, y).each_with_index do |char, index|
|
|
259
|
-
if index >= 1 && index <= title_characters.size
|
|
260
|
-
char.border = nil
|
|
261
|
-
char.value = title_characters[(index - 1)]
|
|
262
|
-
end
|
|
263
|
-
end
|
|
264
|
-
end
|
|
265
|
-
|
|
266
|
-
# @return [Array<String>]
|
|
267
|
-
def title_characters
|
|
268
|
-
@title_characters ||= padded_title.chars
|
|
269
|
-
end
|
|
270
|
-
|
|
271
|
-
# Pads the title with a single whitespace either side.
|
|
272
|
-
#
|
|
273
|
-
# @example
|
|
274
|
-
# title = 'Truncated!'
|
|
275
|
-
# width = 20
|
|
276
|
-
# # => ' Truncated! '
|
|
277
|
-
#
|
|
278
|
-
# width = 10
|
|
279
|
-
# # => ' Trunca '
|
|
280
|
-
#
|
|
281
|
-
# @return [String]
|
|
282
|
-
# @see #truncated_title
|
|
283
|
-
def padded_title
|
|
284
|
-
truncated_title.center(truncated_title.size + 2)
|
|
285
|
-
end
|
|
286
|
-
|
|
287
|
-
# Truncates the title to the width of the interface, minus characters needed
|
|
288
|
-
# to ensure there is at least a single character of horizontal border and a
|
|
289
|
-
# whitespace on either side of the title.
|
|
290
|
-
#
|
|
291
|
-
# @example
|
|
292
|
-
# title = 'Truncated!'
|
|
293
|
-
# width = 20
|
|
294
|
-
# # => 'Truncated!'
|
|
295
|
-
#
|
|
296
|
-
# width = 10
|
|
297
|
-
# # => 'Trunca'
|
|
298
|
-
#
|
|
299
|
-
# @return [String]
|
|
300
|
-
def truncated_title
|
|
301
|
-
title.chomp.slice(0..(width - 5))
|
|
302
|
-
end
|
|
303
|
-
|
|
304
|
-
# Return boolean indicating whether this border has a non-empty title.
|
|
305
|
-
#
|
|
306
|
-
# @return [Boolean]
|
|
307
|
-
def title?
|
|
308
|
-
present?(title)
|
|
309
|
-
end
|
|
310
|
-
|
|
311
|
-
# @param value [String]
|
|
312
|
-
# @param type [Symbol|NilClass]
|
|
313
|
-
# @param iy [Fixnum]
|
|
314
|
-
# @param ix [Fixnum]
|
|
315
|
-
# @return [Vedeu::Char]
|
|
316
|
-
def border(value, type = :border, iy = 0, ix = 0)
|
|
317
|
-
Vedeu::Char.new(value: value,
|
|
318
|
-
parent: interface,
|
|
319
|
-
colour: colour,
|
|
320
|
-
style: style,
|
|
321
|
-
position: Vedeu::Position[iy, ix],
|
|
322
|
-
border: type)
|
|
323
|
-
end
|
|
324
|
-
|
|
325
172
|
# @return [Vedeu::Geometry]
|
|
326
173
|
def geometry
|
|
327
174
|
Vedeu.geometries.by_name(name)
|
|
@@ -331,6 +178,7 @@ module Vedeu
|
|
|
331
178
|
def interface
|
|
332
179
|
@interface ||= Vedeu.interfaces.by_name(name)
|
|
333
180
|
end
|
|
181
|
+
alias_method :parent, :interface
|
|
334
182
|
|
|
335
183
|
# The default values for a new instance of this class.
|
|
336
184
|
#
|
data/lib/vedeu/output/refresh.rb
CHANGED
|
@@ -11,9 +11,7 @@ module Vedeu
|
|
|
11
11
|
#
|
|
12
12
|
# @return [Array]
|
|
13
13
|
def all
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Vedeu.timer(message) do
|
|
14
|
+
Vedeu.timer('Refreshing all interfaces') do
|
|
17
15
|
Vedeu.interfaces.zindexed.each { |model| by_name(model.name) }
|
|
18
16
|
end
|
|
19
17
|
end
|
|
@@ -36,9 +34,7 @@ module Vedeu
|
|
|
36
34
|
# @return [Array|ModelNotFound] A collection of the names of interfaces
|
|
37
35
|
# refreshed, or an exception if the group was not found.
|
|
38
36
|
def by_group(group_name)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Vedeu.timer(message) do
|
|
37
|
+
Vedeu.timer("Refreshing group: '#{group_name}'") do
|
|
42
38
|
members = Vedeu.groups.find!(group_name).members
|
|
43
39
|
interfaces = members.each { |name| Vedeu.interfaces.by_name(name) }
|
|
44
40
|
by_zindex = interfaces.sort { |a, b| a.zindex <=> b.zindex }
|
|
@@ -52,9 +48,9 @@ module Vedeu
|
|
|
52
48
|
# named buffer.
|
|
53
49
|
# @return [Array|ModelNotFound]
|
|
54
50
|
def by_name(name)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
Vedeu.timer("Refreshing interface: '#{name}'") do
|
|
52
|
+
Vedeu.buffers.by_name(name).render
|
|
53
|
+
end
|
|
58
54
|
end
|
|
59
55
|
|
|
60
56
|
end # Refresh
|