vedeu 0.8.16 → 0.8.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/TODO.md +8 -0
- data/examples/dsl_alignment.rb +5 -2
- data/examples/dsl_horizontal_alignment.rb +5 -2
- data/examples/dsl_vertical_alignment.rb +5 -2
- data/integrations/test_runner.sh +2 -3
- data/lib/vedeu.rb +31 -1
- data/lib/vedeu/borders/all.rb +19 -0
- data/lib/vedeu/borders/border.rb +1 -2
- data/lib/vedeu/borders/caption.rb +2 -0
- data/lib/vedeu/borders/refresh.rb +4 -17
- data/lib/vedeu/borders/repository.rb +0 -14
- data/lib/vedeu/borders/title.rb +9 -3
- data/lib/vedeu/buffers/all.rb +25 -0
- data/lib/vedeu/buffers/buffer.rb +2 -2
- data/lib/vedeu/buffers/refresh.rb +1 -15
- data/lib/vedeu/buffers/terminal.rb +0 -15
- data/lib/vedeu/buffers/view.rb +2 -2
- data/lib/vedeu/cells/empty.rb +4 -5
- data/lib/vedeu/coercers/all.rb +0 -5
- data/lib/vedeu/cursors/all.rb +88 -0
- data/lib/vedeu/cursors/cursor.rb +7 -92
- data/lib/vedeu/cursors/move.rb +44 -14
- data/lib/vedeu/cursors/refresh.rb +5 -17
- data/lib/vedeu/cursors/reposition.rb +2 -2
- data/lib/vedeu/distributed/all.rb +16 -0
- data/lib/vedeu/distributed/server.rb +0 -16
- data/lib/vedeu/dsl/dsl.rb +2 -2
- data/lib/vedeu/dsl/helpers/align.rb +1 -1
- data/lib/vedeu/dsl/helpers/attributes.rb +1 -1
- data/lib/vedeu/dsl/helpers/truncate.rb +1 -1
- data/lib/vedeu/dsl/helpers/wordwrap.rb +1 -1
- data/lib/vedeu/dsl/view.rb +1 -1
- data/lib/vedeu/dsl/views.rb +22 -6
- data/lib/vedeu/editor/all.rb +54 -0
- data/lib/vedeu/editor/cropper.rb +3 -5
- data/lib/vedeu/editor/cursor.rb +2 -4
- data/lib/vedeu/editor/document.rb +1 -1
- data/lib/vedeu/editor/editor.rb +2 -17
- data/lib/vedeu/editor/repository.rb +0 -45
- data/lib/vedeu/events/event.rb +1 -1
- data/lib/vedeu/geometries/all.rb +46 -1
- data/lib/vedeu/geometries/area/area.rb +2 -2
- data/lib/vedeu/geometries/dsl/grid.rb +16 -20
- data/lib/vedeu/geometries/geometry.rb +1 -1
- data/lib/vedeu/geometries/move.rb +2 -38
- data/lib/vedeu/geometries/repository.rb +0 -14
- data/lib/vedeu/groups/all.rb +23 -0
- data/lib/vedeu/groups/clear.rb +1 -10
- data/lib/vedeu/groups/group.rb +0 -12
- data/lib/vedeu/groups/refresh.rb +2 -11
- data/lib/vedeu/input/all.rb +35 -0
- data/lib/vedeu/input/capture.rb +2 -2
- data/lib/vedeu/input/mapper.rb +0 -35
- data/lib/vedeu/input/raw.rb +1 -1
- data/lib/vedeu/input/read.rb +1 -1
- data/lib/vedeu/interfaces/all.rb +24 -0
- data/lib/vedeu/interfaces/clear.rb +32 -46
- data/lib/vedeu/interfaces/interface.rb +0 -16
- data/lib/vedeu/menus/all.rb +44 -0
- data/lib/vedeu/menus/menu.rb +13 -8
- data/lib/vedeu/menus/repository.rb +0 -44
- data/lib/vedeu/models/all.rb +13 -0
- data/lib/vedeu/models/focus.rb +0 -13
- data/lib/vedeu/models/toggleable.rb +1 -1
- data/lib/vedeu/null/generic.rb +1 -1
- data/lib/vedeu/output/all.rb +7 -0
- data/lib/vedeu/output/compressor.rb +11 -6
- data/lib/vedeu/output/compressors/character.rb +2 -0
- data/lib/vedeu/output/refresh.rb +0 -7
- data/lib/vedeu/output/viewport.rb +2 -5
- data/lib/vedeu/plugins/plugin.rb +1 -1
- data/lib/vedeu/presentation/colour.rb +6 -1
- data/lib/vedeu/renderers/all.rb +1 -1
- data/lib/vedeu/repositories/repositories.rb +1 -1
- data/lib/vedeu/runtime/all.rb +28 -0
- data/lib/vedeu/runtime/application.rb +0 -18
- data/lib/vedeu/runtime/flags.rb +0 -7
- data/lib/vedeu/runtime/router.rb +0 -11
- data/lib/vedeu/runtime/traps.rb +2 -0
- data/lib/vedeu/templating/view_template.rb +2 -4
- data/lib/vedeu/terminal/all.rb +7 -0
- data/lib/vedeu/terminal/terminal.rb +0 -7
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/view.rb +3 -3
- data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
- data/test/lib/vedeu/cursors/move_test.rb +2 -2
- data/test/lib/vedeu/presentation/colour_test.rb +26 -0
- data/test/support/colour_support.sh +3 -1
- data/test/support/examples/material_colours_app.rb +2 -28
- data/test/support/stats.sh +1 -1
- data/test/test_helper.rb +0 -1
- data/vedeu.gemspec +1 -1
- metadata +4 -6
- data/test/support/helpers/presentation_colour_test_class.rb +0 -31
@@ -183,20 +183,4 @@ module Vedeu
|
|
183
183
|
:show_interface,
|
184
184
|
:toggle_interface
|
185
185
|
|
186
|
-
# :nocov:
|
187
|
-
|
188
|
-
# See {file:docs/events/visibility.md#\_hide_interface_}
|
189
|
-
Vedeu.bind(:_hide_interface_) { |name| Vedeu.hide_interface(name) }
|
190
|
-
Vedeu.bind_alias(:_hide_view_, :_hide_interface_)
|
191
|
-
|
192
|
-
# See {file:docs/events/visibility.md#\_show_interface_}
|
193
|
-
Vedeu.bind(:_show_interface_) { |name| Vedeu.show_interface(name) }
|
194
|
-
Vedeu.bind_alias(:_show_view_, :_show_interface_)
|
195
|
-
|
196
|
-
# See {file:docs/events/visibility.md#\_toggle_interface_}
|
197
|
-
Vedeu.bind(:_toggle_interface_) { |name| Vedeu.toggle_interface(name) }
|
198
|
-
Vedeu.bind_alias(:_toggle_view_, :_toggle_interface_)
|
199
|
-
|
200
|
-
# :nocov:
|
201
|
-
|
202
186
|
end # Vedeu
|
data/lib/vedeu/menus/all.rb
CHANGED
@@ -9,6 +9,50 @@ module Vedeu
|
|
9
9
|
|
10
10
|
end # Menus
|
11
11
|
|
12
|
+
# :nocov:
|
13
|
+
|
14
|
+
# See {file:docs/events/menu.md#\_menu_bottom_}
|
15
|
+
Vedeu.bind(:_menu_bottom_) do |name|
|
16
|
+
Vedeu.menus.by_name(name).bottom_item
|
17
|
+
end
|
18
|
+
|
19
|
+
# See {file:docs/events/menu.md#\_menu_current_}
|
20
|
+
Vedeu.bind(:_menu_current_) do |name|
|
21
|
+
Vedeu.menus.by_name(name).current_item
|
22
|
+
end
|
23
|
+
|
24
|
+
# See {file:docs/events/menu.md#\_menu_deselect_}
|
25
|
+
Vedeu.bind(:_menu_deselect_) do |name|
|
26
|
+
Vedeu.menus.by_name(name).deselect_item
|
27
|
+
end
|
28
|
+
|
29
|
+
# See {file:docs/events/menu.md#\_menu_items_}
|
30
|
+
Vedeu.bind(:_menu_items_) { |name| Vedeu.menus.by_name(name).items }
|
31
|
+
|
32
|
+
# See {file:docs/events/menu.md#\_menu_next_}
|
33
|
+
Vedeu.bind(:_menu_next_) { |name| Vedeu.menus.by_name(name).next_item }
|
34
|
+
|
35
|
+
# See {file:docs/events/menu.md#\_menu_prev_}
|
36
|
+
Vedeu.bind(:_menu_prev_) { |name| Vedeu.menus.by_name(name).prev_item }
|
37
|
+
|
38
|
+
# See {file:docs/events/menu.md#\_menu_selected_}
|
39
|
+
Vedeu.bind(:_menu_selected_) do |name|
|
40
|
+
Vedeu.menus.by_name(name).selected_item
|
41
|
+
end
|
42
|
+
|
43
|
+
# See {file:docs/events/menu.md#\_menu_select_}
|
44
|
+
Vedeu.bind(:_menu_select_) do |name|
|
45
|
+
Vedeu.menus.by_name(name).select_item
|
46
|
+
end
|
47
|
+
|
48
|
+
# See {file:docs/events/menu.md#\_menu_top_}
|
49
|
+
Vedeu.bind(:_menu_top_) { |name| Vedeu.menus.by_name(name).top_item }
|
50
|
+
|
51
|
+
# See {file:docs/events/menu.md#\_menu_view_}
|
52
|
+
Vedeu.bind(:_menu_view_) { |name| Vedeu.menus.by_name(name).view }
|
53
|
+
|
54
|
+
# :nocov:
|
55
|
+
|
12
56
|
end # Vedeu
|
13
57
|
|
14
58
|
require 'vedeu/menus/dsl'
|
data/lib/vedeu/menus/menu.rb
CHANGED
@@ -11,9 +11,9 @@ module Vedeu
|
|
11
11
|
|
12
12
|
include Vedeu::Repositories::Model
|
13
13
|
|
14
|
-
# @!attribute [
|
14
|
+
# @!attribute [w] collection
|
15
15
|
# @return [Array]
|
16
|
-
|
16
|
+
attr_writer :collection
|
17
17
|
|
18
18
|
# Returns the index of the value in the collection which is
|
19
19
|
# current.
|
@@ -50,12 +50,17 @@ module Vedeu
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
# @return [Array]
|
54
|
+
def collection
|
55
|
+
@collection || []
|
56
|
+
end
|
57
|
+
|
53
58
|
# Returns the item from the collection which shares the same
|
54
59
|
# index as the value of {Vedeu::Menus::Menu#current}.
|
55
60
|
#
|
56
61
|
# @return [void]
|
57
62
|
def current_item
|
58
|
-
|
63
|
+
collection[@current]
|
59
64
|
end
|
60
65
|
|
61
66
|
# Returns a DSL instance responsible for defining the DSL
|
@@ -77,7 +82,7 @@ module Vedeu
|
|
77
82
|
def selected_item
|
78
83
|
return nil unless @selected
|
79
84
|
|
80
|
-
|
85
|
+
collection[@selected]
|
81
86
|
end
|
82
87
|
|
83
88
|
# Returns a new collection of items.
|
@@ -94,7 +99,7 @@ module Vedeu
|
|
94
99
|
# @return [Array]
|
95
100
|
def items
|
96
101
|
items = []
|
97
|
-
|
102
|
+
collection.each_with_index do |item, index|
|
98
103
|
items << if index == @current && index == @selected
|
99
104
|
[true, true, item]
|
100
105
|
|
@@ -116,7 +121,7 @@ module Vedeu
|
|
116
121
|
#
|
117
122
|
# @return [Array]
|
118
123
|
def view
|
119
|
-
items[@current,
|
124
|
+
items[@current, collection.size]
|
120
125
|
end
|
121
126
|
|
122
127
|
# Sets the value of current to be the first item of the
|
@@ -183,14 +188,14 @@ module Vedeu
|
|
183
188
|
#
|
184
189
|
# @return [Fixnum]
|
185
190
|
def last
|
186
|
-
|
191
|
+
collection.size - 1
|
187
192
|
end
|
188
193
|
|
189
194
|
# Returns the size of the collection.
|
190
195
|
#
|
191
196
|
# @return [Fixnum]
|
192
197
|
def size
|
193
|
-
|
198
|
+
collection.size
|
194
199
|
end
|
195
200
|
|
196
201
|
private
|
@@ -28,48 +28,4 @@ module Vedeu
|
|
28
28
|
def_delegators Vedeu::Menus::Repository,
|
29
29
|
:menus
|
30
30
|
|
31
|
-
# :nocov:
|
32
|
-
|
33
|
-
# See {file:docs/events/menu.md#\_menu_bottom_}
|
34
|
-
Vedeu.bind(:_menu_bottom_) do |name|
|
35
|
-
Vedeu.menus.by_name(name).bottom_item
|
36
|
-
end
|
37
|
-
|
38
|
-
# See {file:docs/events/menu.md#\_menu_current_}
|
39
|
-
Vedeu.bind(:_menu_current_) do |name|
|
40
|
-
Vedeu.menus.by_name(name).current_item
|
41
|
-
end
|
42
|
-
|
43
|
-
# See {file:docs/events/menu.md#\_menu_deselect_}
|
44
|
-
Vedeu.bind(:_menu_deselect_) do |name|
|
45
|
-
Vedeu.menus.by_name(name).deselect_item
|
46
|
-
end
|
47
|
-
|
48
|
-
# See {file:docs/events/menu.md#\_menu_items_}
|
49
|
-
Vedeu.bind(:_menu_items_) { |name| Vedeu.menus.by_name(name).items }
|
50
|
-
|
51
|
-
# See {file:docs/events/menu.md#\_menu_next_}
|
52
|
-
Vedeu.bind(:_menu_next_) { |name| Vedeu.menus.by_name(name).next_item }
|
53
|
-
|
54
|
-
# See {file:docs/events/menu.md#\_menu_prev_}
|
55
|
-
Vedeu.bind(:_menu_prev_) { |name| Vedeu.menus.by_name(name).prev_item }
|
56
|
-
|
57
|
-
# See {file:docs/events/menu.md#\_menu_selected_}
|
58
|
-
Vedeu.bind(:_menu_selected_) do |name|
|
59
|
-
Vedeu.menus.by_name(name).selected_item
|
60
|
-
end
|
61
|
-
|
62
|
-
# See {file:docs/events/menu.md#\_menu_select_}
|
63
|
-
Vedeu.bind(:_menu_select_) do |name|
|
64
|
-
Vedeu.menus.by_name(name).select_item
|
65
|
-
end
|
66
|
-
|
67
|
-
# See {file:docs/events/menu.md#\_menu_top_}
|
68
|
-
Vedeu.bind(:_menu_top_) { |name| Vedeu.menus.by_name(name).top_item }
|
69
|
-
|
70
|
-
# See {file:docs/events/menu.md#\_menu_view_}
|
71
|
-
Vedeu.bind(:_menu_view_) { |name| Vedeu.menus.by_name(name).view }
|
72
|
-
|
73
|
-
# :nocov:
|
74
|
-
|
75
31
|
end # Vedeu
|
data/lib/vedeu/models/all.rb
CHANGED
@@ -8,6 +8,19 @@ module Vedeu
|
|
8
8
|
|
9
9
|
end # Models
|
10
10
|
|
11
|
+
# :nocov:
|
12
|
+
|
13
|
+
# See {file:docs/events/focus.md#\_focus_by_name_}
|
14
|
+
Vedeu.bind(:_focus_by_name_) { |name| Vedeu.focus_by_name(name) }
|
15
|
+
|
16
|
+
# See {file:docs/events/focus.md#\_focus_next_}
|
17
|
+
Vedeu.bind(:_focus_next_) { Vedeu.focus_next }
|
18
|
+
|
19
|
+
# See {file:docs/events/focus.md#\_focus_prev_}
|
20
|
+
Vedeu.bind(:_focus_prev_) { Vedeu.focus_previous }
|
21
|
+
|
22
|
+
# :nocov:
|
23
|
+
|
11
24
|
end # Vedeu
|
12
25
|
|
13
26
|
require 'vedeu/models/toggleable'
|
data/lib/vedeu/models/focus.rb
CHANGED
@@ -271,17 +271,4 @@ module Vedeu
|
|
271
271
|
:focus_next,
|
272
272
|
:focus_previous
|
273
273
|
|
274
|
-
# :nocov:
|
275
|
-
|
276
|
-
# See {file:docs/events/focus.md#\_focus_by_name_}
|
277
|
-
Vedeu.bind(:_focus_by_name_) { |name| Vedeu.focus_by_name(name) }
|
278
|
-
|
279
|
-
# See {file:docs/events/focus.md#\_focus_next_}
|
280
|
-
Vedeu.bind(:_focus_next_) { Vedeu.focus_next }
|
281
|
-
|
282
|
-
# See {file:docs/events/focus.md#\_focus_prev_}
|
283
|
-
Vedeu.bind(:_focus_prev_) { Vedeu.focus_previous }
|
284
|
-
|
285
|
-
# :nocov:
|
286
|
-
|
287
274
|
end # Vedeu
|
data/lib/vedeu/null/generic.rb
CHANGED
data/lib/vedeu/output/all.rb
CHANGED
@@ -24,7 +24,7 @@ module Vedeu
|
|
24
24
|
|
25
25
|
# Returns a new instance of Vedeu::Output::Compressor.
|
26
26
|
#
|
27
|
-
# @param output [
|
27
|
+
# @param output [Vedeu::Models::Page]
|
28
28
|
# @param options [Hash]
|
29
29
|
# @option options compression [Boolean]
|
30
30
|
# @return [Vedeu::Output::Compressor]
|
@@ -41,6 +41,10 @@ module Vedeu
|
|
41
41
|
def render
|
42
42
|
return [] unless output?
|
43
43
|
|
44
|
+
Vedeu.log(type: :compress,
|
45
|
+
message: "Original size: #{original_size} / " \
|
46
|
+
"New size: #{content_size}")
|
47
|
+
|
44
48
|
Vedeu::Output::CompressorCache.cache(content, compression?)
|
45
49
|
end
|
46
50
|
|
@@ -57,17 +61,18 @@ module Vedeu
|
|
57
61
|
#
|
58
62
|
# @return [Array]
|
59
63
|
def content
|
60
|
-
output.content.reject do |cell|
|
64
|
+
@_content ||= output.content.reject do |cell|
|
61
65
|
cell.class == Vedeu::Cells::Empty
|
62
|
-
end.tap do |cells|
|
63
|
-
Vedeu.log(type: :compress,
|
64
|
-
message: "Orignal size: #{content_size} / " \
|
65
|
-
"New size: #{cells.size}")
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
# @return [Fixnum]
|
70
70
|
def content_size
|
71
|
+
content.size
|
72
|
+
end
|
73
|
+
|
74
|
+
# @return [Fixnum]
|
75
|
+
def original_size
|
71
76
|
output.content.size
|
72
77
|
end
|
73
78
|
|
data/lib/vedeu/output/refresh.rb
CHANGED
@@ -97,15 +97,12 @@ module Vedeu
|
|
97
97
|
offset - dimension
|
98
98
|
end
|
99
99
|
|
100
|
-
# @
|
101
|
-
# @see Vedeu::Cursors::Repository#by_name
|
100
|
+
# @macro cursor_by_name
|
102
101
|
def cursor
|
103
102
|
Vedeu.cursors.by_name(name)
|
104
103
|
end
|
105
104
|
|
106
|
-
#
|
107
|
-
#
|
108
|
-
# @return (see Vedeu::Geometries::Repository#by_name)
|
105
|
+
# @macro geometry_by_name
|
109
106
|
def geometry
|
110
107
|
Vedeu.geometries.by_name(name)
|
111
108
|
end
|
data/lib/vedeu/plugins/plugin.rb
CHANGED
@@ -118,9 +118,14 @@ module Vedeu
|
|
118
118
|
|
119
119
|
private
|
120
120
|
|
121
|
+
# @macro interface_by_name
|
122
|
+
def interface
|
123
|
+
Vedeu.interfaces.by_name(name)
|
124
|
+
end
|
125
|
+
|
121
126
|
# @return [Vedeu::Colours::Colour]
|
122
127
|
def named_colour
|
123
|
-
|
128
|
+
interface.colour
|
124
129
|
end
|
125
130
|
|
126
131
|
# @return [Boolean]
|
data/lib/vedeu/renderers/all.rb
CHANGED
data/lib/vedeu/runtime/all.rb
CHANGED
@@ -8,6 +8,34 @@ module Vedeu
|
|
8
8
|
|
9
9
|
end # Runtime
|
10
10
|
|
11
|
+
# :nocov:
|
12
|
+
|
13
|
+
# See {file:docs/events/system.md#\_cleanup_}
|
14
|
+
Vedeu.bind(:_cleanup_) do
|
15
|
+
Vedeu.trigger(:_drb_stop_)
|
16
|
+
Vedeu.trigger(:cleanup)
|
17
|
+
end
|
18
|
+
|
19
|
+
# See {file:docs/events/system.md#\_exit_}
|
20
|
+
Vedeu.bind(:_exit_) { Vedeu.exit }
|
21
|
+
|
22
|
+
# See {file:docs/events/application.md#\_goto_}
|
23
|
+
Vedeu.bind(:_goto_) do |controller, action, **args|
|
24
|
+
Vedeu::Runtime::Router.goto(controller, action, **args)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Vedeu.bind_alias(:_action_, :_goto_)
|
28
|
+
|
29
|
+
# See {file:docs/events/system.md#\_initialize_}
|
30
|
+
Vedeu.bind(:_initialize_) { Vedeu.ready! }
|
31
|
+
|
32
|
+
# See {file:docs/events/system.md#\_mode_switch_}
|
33
|
+
Vedeu.bind(:_mode_switch_) do |mode|
|
34
|
+
Vedeu::Runtime::MainLoop.mode_switch!(mode)
|
35
|
+
end
|
36
|
+
|
37
|
+
# :nocov:
|
38
|
+
|
11
39
|
end # Vedeu
|
12
40
|
|
13
41
|
require 'vedeu/runtime/traps'
|
@@ -144,22 +144,4 @@ module Vedeu
|
|
144
144
|
def_delegators Vedeu::Runtime::Application,
|
145
145
|
:exit
|
146
146
|
|
147
|
-
# :nocov:
|
148
|
-
|
149
|
-
# See {file:docs/events/system.md#\_exit_}
|
150
|
-
Vedeu.bind(:_exit_) { Vedeu.exit }
|
151
|
-
|
152
|
-
# See {file:docs/events/system.md#\_mode_switch_}
|
153
|
-
Vedeu.bind(:_mode_switch_) do |mode|
|
154
|
-
Vedeu::Runtime::MainLoop.mode_switch!(mode)
|
155
|
-
end
|
156
|
-
|
157
|
-
# See {file:docs/events/system.md#\_cleanup_}
|
158
|
-
Vedeu.bind(:_cleanup_) do
|
159
|
-
Vedeu.trigger(:_drb_stop_)
|
160
|
-
Vedeu.trigger(:cleanup)
|
161
|
-
end
|
162
|
-
|
163
|
-
# :nocov:
|
164
|
-
|
165
147
|
end # Vedeu
|