vedeu 0.6.60 → 0.6.61
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/dsl.md +18 -18
- data/docs/events/drb.md +2 -8
- data/docs/events/view.md +2 -2
- data/docs/events/visibility.md +1 -4
- data/lib/vedeu/all.rb +1 -1
- data/lib/vedeu/borders/border.rb +1 -1
- data/lib/vedeu/borders/refresh.rb +1 -1
- data/lib/vedeu/buffers/empty.rb +6 -4
- data/lib/vedeu/buffers/view.rb +78 -7
- data/lib/vedeu/cursors/cursor.rb +7 -5
- data/lib/vedeu/cursors/refresh.rb +1 -1
- data/lib/vedeu/cursors/reposition.rb +5 -3
- data/lib/vedeu/cursors/repository.rb +4 -6
- data/lib/vedeu/dsl/shared.rb +5 -5
- data/lib/vedeu/editor/cropper.rb +1 -1
- data/lib/vedeu/editor/cursor.rb +2 -2
- data/lib/vedeu/editor/item.rb +3 -3
- data/lib/vedeu/error.rb +1 -1
- data/lib/vedeu/esc/esc.rb +1 -1
- data/lib/vedeu/events/aliases.rb +2 -2
- data/lib/vedeu/{geometry → geometries}/alignment.rb +8 -8
- data/lib/vedeu/geometries/all.rb +31 -0
- data/lib/vedeu/{geometry → geometries}/area.rb +8 -8
- data/lib/vedeu/{geometry → geometries}/coordinate.rb +5 -5
- data/lib/vedeu/{geometry → geometries}/dimension.rb +6 -6
- data/lib/vedeu/{geometry → geometries}/dsl.rb +22 -22
- data/lib/vedeu/{geometry → geometries}/geometry.rb +15 -15
- data/lib/vedeu/{geometry → geometries}/grid.rb +6 -6
- data/lib/vedeu/{geometry → geometries}/horizontal_alignment.rb +3 -3
- data/lib/vedeu/{geometry → geometries}/move.rb +5 -5
- data/lib/vedeu/{geometry → geometries}/position.rb +18 -18
- data/lib/vedeu/{geometry → geometries}/repository.rb +9 -9
- data/lib/vedeu/{geometry → geometries}/validator.rb +3 -3
- data/lib/vedeu/{geometry → geometries}/vertical_alignment.rb +3 -3
- data/lib/vedeu/{geometry → geometries}/x_dimension.rb +4 -4
- data/lib/vedeu/{geometry → geometries}/y_dimension.rb +4 -4
- data/lib/vedeu/groups/group.rb +2 -1
- data/lib/vedeu/input/store.rb +2 -1
- data/lib/vedeu/interfaces/clear.rb +8 -6
- data/lib/vedeu/interfaces/interface.rb +1 -1
- data/lib/vedeu/models/cell.rb +2 -2
- data/lib/vedeu/models/escape.rb +2 -2
- data/lib/vedeu/models/focus.rb +2 -1
- data/lib/vedeu/models/page.rb +3 -2
- data/lib/vedeu/models/row.rb +10 -1
- data/lib/vedeu/models/views/char.rb +6 -6
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/output/compressor.rb +10 -15
- data/lib/vedeu/output/presentation/presentation.rb +1 -1
- data/lib/vedeu/output/renderers/all.rb +7 -8
- data/lib/vedeu/output/viewport.rb +1 -1
- data/lib/vedeu/repositories/store.rb +2 -2
- data/lib/vedeu/terminal/buffer.rb +46 -102
- data/lib/vedeu/terminal/terminal.rb +10 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/refresh_test.rb +1 -1
- data/test/lib/vedeu/buffers/empty_test.rb +3 -3
- data/test/lib/vedeu/buffers/view_test.rb +48 -1
- data/test/lib/vedeu/cursors/cursor_test.rb +2 -2
- data/test/lib/vedeu/editor/cropper_test.rb +1 -1
- data/test/lib/vedeu/editor/cursor_test.rb +1 -1
- data/test/lib/vedeu/editor/document_test.rb +2 -2
- data/test/lib/vedeu/{geometry → geometries}/alignment_test.rb +5 -5
- data/test/lib/vedeu/{geometry → geometries}/area_test.rb +4 -4
- data/test/lib/vedeu/{geometry → geometries}/coordinate.rb +5 -5
- data/test/lib/vedeu/{geometry → geometries}/dimension_test.rb +7 -5
- data/test/lib/vedeu/{geometry → geometries}/dsl_test.rb +31 -27
- data/test/lib/vedeu/{geometry → geometries}/geometry_test.rb +10 -7
- data/test/lib/vedeu/{geometry → geometries}/grid_test.rb +13 -9
- data/test/lib/vedeu/{geometry → geometries}/horizontal_alignment_test.rb +3 -3
- data/test/lib/vedeu/{geometry → geometries}/move_test.rb +10 -10
- data/test/lib/vedeu/{geometry → geometries}/position_test.rb +16 -15
- data/test/lib/vedeu/{geometry → geometries}/repository_test.rb +3 -3
- data/test/lib/vedeu/{geometry → geometries}/validator_test.rb +4 -4
- data/test/lib/vedeu/{geometry → geometries}/vertical_alignment_test.rb +3 -3
- data/test/lib/vedeu/{geometry → geometries}/x_dimension_test.rb +3 -3
- data/test/lib/vedeu/{geometry → geometries}/y_dimension_test.rb +3 -3
- data/test/lib/vedeu/interfaces/clear_test.rb +1 -1
- data/test/lib/vedeu/models/cell_test.rb +1 -1
- data/test/lib/vedeu/models/escape_test.rb +2 -2
- data/test/lib/vedeu/models/page_test.rb +18 -2
- data/test/lib/vedeu/models/views/char_test.rb +3 -3
- data/test/lib/vedeu/output/compressor_test.rb +30 -16
- data/test/lib/vedeu/output/renderers/html_test.rb +1 -1
- data/test/lib/vedeu/output/renderers/json_test.rb +17 -1
- data/test/lib/vedeu/output/viewport_test.rb +1 -1
- data/test/lib/vedeu/terminal/buffer_test.rb +6 -18
- data/test/lib/vedeu/terminal/terminal_test.rb +1 -1
- data/test/support/examples/material_colours_app.rb +2 -0
- data/test/test_helper.rb +1 -1
- metadata +48 -48
- data/lib/vedeu/geometry/all.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caa790910d980d060680517416aab7206faea84f
|
4
|
+
data.tar.gz: b8ce3a4ae71d898bbd1c99da090b3d66976b0bb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97f27f54135a8415d01fc5c2b3f65d1652ba3b057c63fc5f9f0baf67ec07f7560340b652b40fbeea864015e0423eac7d4b877c0259f7451fc5316965987e2dcb
|
7
|
+
data.tar.gz: f895269aef915276b769640d7f77e02cffb79f0ec920dc50a173967c737d80c2866bade305ff064e82465264caddcebec48c0481ed80ce4391edc045396af07c
|
data/docs/dsl.md
CHANGED
@@ -105,27 +105,27 @@ end
|
|
105
105
|
|
106
106
|
## Geometry
|
107
107
|
|
108
|
-
{include:Vedeu::
|
108
|
+
{include:Vedeu::Geometries::DSL}
|
109
109
|
|
110
110
|
### Setting the interface dimensions
|
111
111
|
|
112
|
-
{include:Vedeu::
|
113
|
-
{include:Vedeu::
|
114
|
-
{include:Vedeu::
|
115
|
-
{include:Vedeu::
|
116
|
-
{include:Vedeu::
|
117
|
-
{include:Vedeu::
|
118
|
-
{include:Vedeu::
|
119
|
-
{include:Vedeu::
|
120
|
-
{include:Vedeu::
|
121
|
-
{include:Vedeu::
|
122
|
-
{include:Vedeu::
|
123
|
-
{include:Vedeu::
|
124
|
-
{include:Vedeu::
|
125
|
-
{include:Vedeu::
|
126
|
-
{include:Vedeu::
|
127
|
-
{include:Vedeu::
|
128
|
-
{include:Vedeu::
|
112
|
+
{include:Vedeu::Geometries::DSL#align}
|
113
|
+
{include:Vedeu::Geometries::DSL#align_left}
|
114
|
+
{include:Vedeu::Geometries::DSL#align_centre}
|
115
|
+
{include:Vedeu::Geometries::DSL#align_right}
|
116
|
+
{include:Vedeu::Geometries::DSL#align_top}
|
117
|
+
{include:Vedeu::Geometries::DSL#align_middle}
|
118
|
+
{include:Vedeu::Geometries::DSL#align_bottom}
|
119
|
+
{include:Vedeu::Geometries::DSL#horizontal_alignment}
|
120
|
+
{include:Vedeu::Geometries::DSL#vertical_alignment}
|
121
|
+
{include:Vedeu::Geometries::DSL#height}
|
122
|
+
{include:Vedeu::Geometries::DSL#width}
|
123
|
+
{include:Vedeu::Geometries::DSL#columns}
|
124
|
+
{include:Vedeu::Geometries::DSL#rows}
|
125
|
+
{include:Vedeu::Geometries::DSL#x}
|
126
|
+
{include:Vedeu::Geometries::DSL#xn}
|
127
|
+
{include:Vedeu::Geometries::DSL#y}
|
128
|
+
{include:Vedeu::Geometries::DSL#yn}
|
129
129
|
|
130
130
|
## Groups
|
131
131
|
|
data/docs/events/drb.md
CHANGED
@@ -11,16 +11,10 @@ Note: See {Vedeu::Distributed::Server#input} for parameter details.
|
|
11
11
|
Vedeu.trigger(:_drb_input_, data, type)
|
12
12
|
|
13
13
|
### `:\_drb_retrieve_output\_`
|
14
|
-
|
15
|
-
Vedeu.trigger(:_drb_retrieve_output_)
|
14
|
+
See {Vedeu::Terminal::Buffer#output}
|
16
15
|
|
17
16
|
### `:\_drb_store_output\_`
|
18
|
-
|
19
|
-
application's virtual buffer.
|
20
|
-
|
21
|
-
Note: See {Vedeu::Terminal::Buffer#write} for parameter details.
|
22
|
-
|
23
|
-
Vedeu.trigger(:_drb_store_output_, data)
|
17
|
+
See {Vedeu::Terminal::Buffer#write}
|
24
18
|
|
25
19
|
### `:\_drb_restart\_`
|
26
20
|
Use the DRb server to request the client application to restart.
|
data/docs/events/view.md
CHANGED
@@ -9,7 +9,7 @@ Maximising an interface.
|
|
9
9
|
|
10
10
|
Vedeu.trigger(:_maximise_, name)
|
11
11
|
|
12
|
-
See {Vedeu::
|
12
|
+
See {Vedeu::Geometries::Geometry#maximise}
|
13
13
|
|
14
14
|
### `:\_movement_refresh\_`
|
15
15
|
When triggered, triggers additional events which aid the updating of
|
@@ -42,4 +42,4 @@ Unmaximising an interface.
|
|
42
42
|
|
43
43
|
Vedeu.trigger(:_unmaximise_, name)
|
44
44
|
|
45
|
-
See {Vedeu::
|
45
|
+
See {Vedeu::Geometries::Geometry#unmaximise}
|
data/docs/events/visibility.md
CHANGED
@@ -5,10 +5,7 @@
|
|
5
5
|
Note: 'name' is a Symbol unless mentioned otherwise.
|
6
6
|
|
7
7
|
### `:\_clear\_`
|
8
|
-
|
9
|
-
|
10
|
-
Vedeu.trigger(:_clear_)
|
11
|
-
Vedeu.clear
|
8
|
+
See {Vedeu::Terminal::Buffer#clear}
|
12
9
|
|
13
10
|
### `:\_clear_group\_`
|
14
11
|
Clears the spaces occupied by the interfaces belonging to the named
|
data/lib/vedeu/all.rb
CHANGED
@@ -27,7 +27,7 @@ require 'vedeu/buffers/all'
|
|
27
27
|
require 'vedeu/colours/all'
|
28
28
|
require 'vedeu/distributed/all'
|
29
29
|
require 'vedeu/editor/all'
|
30
|
-
require 'vedeu/
|
30
|
+
require 'vedeu/geometries/all'
|
31
31
|
require 'vedeu/groups/all'
|
32
32
|
require 'vedeu/input/all'
|
33
33
|
require 'vedeu/interfaces/all'
|
data/lib/vedeu/borders/border.rb
CHANGED
data/lib/vedeu/buffers/empty.rb
CHANGED
@@ -16,11 +16,13 @@ module Vedeu
|
|
16
16
|
|
17
17
|
# @return [Array<Array<Vedeu::Models::Cell>>]
|
18
18
|
def buffer
|
19
|
-
Array.new(
|
20
|
-
|
21
|
-
|
19
|
+
Array.new(height) do |y|
|
20
|
+
unless y == 0
|
21
|
+
Array.new(width) do |x|
|
22
|
+
Vedeu::Models::Cell.new(name: name, position: [y, x]) unless x == 0
|
23
|
+
end.compact
|
22
24
|
end
|
23
|
-
end
|
25
|
+
end.compact
|
24
26
|
end
|
25
27
|
|
26
28
|
# @note
|
data/lib/vedeu/buffers/view.rb
CHANGED
@@ -9,14 +9,52 @@ module Vedeu
|
|
9
9
|
class View
|
10
10
|
|
11
11
|
include Vedeu::Repositories::Defaults
|
12
|
+
include Enumerable
|
12
13
|
|
13
|
-
|
14
|
+
# @return [Hash<Symbol => String|Symbol>]
|
15
|
+
def attributes
|
16
|
+
{
|
17
|
+
name: name
|
18
|
+
}
|
19
|
+
end
|
14
20
|
|
15
|
-
#
|
16
|
-
|
17
|
-
|
21
|
+
# Provides iteration over the buffer.
|
22
|
+
#
|
23
|
+
# @param block [Proc]
|
24
|
+
# @return [Enumerator]
|
25
|
+
def each(&block)
|
26
|
+
current.each(&block)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Resets the named view buffer back to its empty state.
|
30
|
+
#
|
31
|
+
# @return [Vedeu::Buffers::View]
|
32
|
+
def reset!
|
33
|
+
Vedeu::Buffers::View.new(attributes)
|
34
|
+
end
|
35
|
+
|
36
|
+
# @param value_or_values [Array<Array<Vedeu::Views::Char>>|
|
37
|
+
# Vedeu::Views::Char]
|
38
|
+
# @return [Vedeu::Buffers::View]
|
39
|
+
def update(value_or_values)
|
40
|
+
Array(value_or_values).flatten.each do |value|
|
41
|
+
if valid?(value)
|
42
|
+
current[value.position.y][value.position.x] = value
|
43
|
+
dirty << value.position.to_a
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
self
|
18
48
|
end
|
19
49
|
|
50
|
+
protected
|
51
|
+
|
52
|
+
# @!attribute [r] name
|
53
|
+
# @return [String|Symbol]
|
54
|
+
attr_reader :name
|
55
|
+
|
56
|
+
private
|
57
|
+
|
20
58
|
# @return [Vedeu::Buffers::Empty]
|
21
59
|
def buffer
|
22
60
|
@_buffer ||= Vedeu::Buffers::Empty
|
@@ -25,7 +63,7 @@ module Vedeu
|
|
25
63
|
width: geometry.bordered_width).buffer
|
26
64
|
end
|
27
65
|
|
28
|
-
# @return [Vedeu::
|
66
|
+
# @return [Array<Vedeu::Models::Cell>]
|
29
67
|
def current
|
30
68
|
@current ||= buffer
|
31
69
|
end
|
@@ -44,12 +82,45 @@ module Vedeu
|
|
44
82
|
|
45
83
|
# @return [Vedeu::Buffers::Empty]
|
46
84
|
def dirty
|
47
|
-
@dirty ||=
|
85
|
+
@dirty ||= []
|
48
86
|
end
|
49
87
|
|
50
88
|
# @return [Vedeu::Buffers::Empty]
|
51
89
|
def dirty_reset!
|
52
|
-
@dirty =
|
90
|
+
@dirty = []
|
91
|
+
end
|
92
|
+
|
93
|
+
# @return [Vedeu::Geometries::Geometry]
|
94
|
+
def geometry
|
95
|
+
@_geometry ||= Vedeu.geometries.by_name(name)
|
96
|
+
end
|
97
|
+
|
98
|
+
# Returns a boolean indicating the value has a position
|
99
|
+
# attribute and is within the terminal boundary.
|
100
|
+
#
|
101
|
+
# @param value [void]
|
102
|
+
# @return [Boolean]
|
103
|
+
def valid?(value)
|
104
|
+
valid_value?(value) && valid_position?(value)
|
105
|
+
end
|
106
|
+
|
107
|
+
# Returns a boolean indicating whether the position of the value
|
108
|
+
# object is valid for this terminal.
|
109
|
+
#
|
110
|
+
# @param value [void]
|
111
|
+
# @return [Boolean]
|
112
|
+
def valid_position?(value)
|
113
|
+
buffer[value.position.y] && buffer[value.position.y][value.position.x]
|
114
|
+
end
|
115
|
+
|
116
|
+
# Returns a boolean indicating the value has a position
|
117
|
+
# attribute.
|
118
|
+
#
|
119
|
+
# @param value [void]
|
120
|
+
# @return [Boolean]
|
121
|
+
def valid_value?(value)
|
122
|
+
value.respond_to?(:position) &&
|
123
|
+
value.position.is_a?(Vedeu::Geometries::Position)
|
53
124
|
end
|
54
125
|
|
55
126
|
end # View
|
data/lib/vedeu/cursors/cursor.rb
CHANGED
@@ -214,9 +214,9 @@ module Vedeu
|
|
214
214
|
|
215
215
|
# Return the position of this cursor.
|
216
216
|
#
|
217
|
-
# @return [Vedeu::
|
217
|
+
# @return [Vedeu::Geometries::Position]
|
218
218
|
def position
|
219
|
-
@position = Vedeu::
|
219
|
+
@position = Vedeu::Geometries::Position[y, x]
|
220
220
|
end
|
221
221
|
|
222
222
|
# Show a named cursor, or without a name, the cursor of the
|
@@ -255,16 +255,18 @@ module Vedeu
|
|
255
255
|
|
256
256
|
# Returns the geometry for the interface.
|
257
257
|
#
|
258
|
-
# @return (see Vedeu::
|
258
|
+
# @return (see Vedeu::Geometries::Repository#by_name)
|
259
259
|
def geometry
|
260
260
|
@geometry ||= Vedeu.geometries.by_name(name)
|
261
261
|
end
|
262
262
|
|
263
263
|
# Determine correct x and y related coordinates.
|
264
264
|
#
|
265
|
-
# @return [Vedeu::
|
265
|
+
# @return [Vedeu::Geometries::Coordinate]
|
266
266
|
def coordinate(offset, type)
|
267
|
-
Vedeu::
|
267
|
+
Vedeu::Geometries::Coordinate.new(name: name,
|
268
|
+
offset: offset,
|
269
|
+
type: type)
|
268
270
|
end
|
269
271
|
|
270
272
|
# The default values for a new instance of this class.
|
@@ -57,9 +57,11 @@ module Vedeu
|
|
57
57
|
#
|
58
58
|
# @param offset []
|
59
59
|
# @param type []
|
60
|
-
# @return [Vedeu::
|
60
|
+
# @return [Vedeu::Geometries::Coordinate]
|
61
61
|
def coordinate(offset, type)
|
62
|
-
Vedeu::
|
62
|
+
Vedeu::Geometries::Coordinate.new(name: name,
|
63
|
+
offset: offset,
|
64
|
+
type: type)
|
63
65
|
end
|
64
66
|
|
65
67
|
# @return [Vedeu::Cursors::Cursor]
|
@@ -77,7 +79,7 @@ module Vedeu
|
|
77
79
|
}
|
78
80
|
end
|
79
81
|
|
80
|
-
# @return [Vedeu::
|
82
|
+
# @return [Vedeu::Geometries::Geometry]
|
81
83
|
def geometry
|
82
84
|
Vedeu.geometries.by_name(name)
|
83
85
|
end
|
@@ -35,19 +35,17 @@ module Vedeu
|
|
35
35
|
|
36
36
|
end # Cursors
|
37
37
|
|
38
|
-
# @!method cursor
|
39
|
-
# @see Vedeu::Cursors::Repository.cursor
|
40
|
-
def_delegators Vedeu::Cursors::Repository,
|
41
|
-
:cursor
|
42
|
-
|
43
38
|
# Manipulate the repository of cursors.
|
44
39
|
#
|
45
40
|
# @example
|
46
41
|
# Vedeu.cursors
|
47
42
|
#
|
48
43
|
# @!method cursors
|
49
|
-
#
|
44
|
+
# @return [Vedeu::Cursors::Repository]
|
45
|
+
# @!method cursor
|
46
|
+
# @see Vedeu::Cursors::Repository.cursor
|
50
47
|
def_delegators Vedeu::Cursors::Repository,
|
48
|
+
:cursor,
|
51
49
|
:cursors
|
52
50
|
|
53
51
|
end # Vedeu
|
data/lib/vedeu/dsl/shared.rb
CHANGED
@@ -57,7 +57,7 @@ module Vedeu
|
|
57
57
|
# @example
|
58
58
|
# Vedeu.interface :my_interface do
|
59
59
|
# geometry do
|
60
|
-
# # ... see Vedeu::
|
60
|
+
# # ... see Vedeu::Geometries::DSL for DSL methods for
|
61
61
|
# # geometries.
|
62
62
|
# end
|
63
63
|
# end
|
@@ -65,17 +65,17 @@ module Vedeu
|
|
65
65
|
# @param name [String|Symbol] The name of the interface; this is
|
66
66
|
# already provided when we define the interface or view,
|
67
67
|
# setting it here is just mirroring functionality of
|
68
|
-
# {Vedeu::
|
68
|
+
# {Vedeu::Geometries::DSL.geometry}.
|
69
69
|
# @param block [Proc]
|
70
70
|
# @raise [Vedeu::Error::RequiresBlock]
|
71
|
-
# @return [Vedeu::
|
72
|
-
# @see Vedeu::
|
71
|
+
# @return [Vedeu::Geometries::Geometry]
|
72
|
+
# @see Vedeu::Geometries::DSL
|
73
73
|
def geometry(name = nil, &block)
|
74
74
|
fail Vedeu::Error::RequiresBlock unless block_given?
|
75
75
|
|
76
76
|
model_name = name ? name : model.name
|
77
77
|
|
78
|
-
Vedeu::
|
78
|
+
Vedeu::Geometries::Geometry.build(name: model_name, &block).store
|
79
79
|
end
|
80
80
|
|
81
81
|
end # Shared
|
data/lib/vedeu/editor/cropper.rb
CHANGED
@@ -106,7 +106,7 @@ module Vedeu
|
|
106
106
|
|
107
107
|
# Returns the border for the interface.
|
108
108
|
#
|
109
|
-
# @return (see Vedeu::
|
109
|
+
# @return (see Vedeu::Geometries::Repository#by_name)
|
110
110
|
def geometry
|
111
111
|
@geometry ||= Vedeu.geometries.by_name(name)
|
112
112
|
end
|
data/lib/vedeu/editor/cursor.rb
CHANGED
@@ -164,9 +164,9 @@ module Vedeu
|
|
164
164
|
|
165
165
|
# Returns the geometry for the interface.
|
166
166
|
#
|
167
|
-
# @return (see Vedeu::
|
167
|
+
# @return (see Vedeu::Geometries::Repository#by_name)
|
168
168
|
def geometry
|
169
|
-
@
|
169
|
+
@geometry ||= Vedeu.geometries.by_name(name)
|
170
170
|
end
|
171
171
|
|
172
172
|
# Returns the default options/attributes for this class.
|
data/lib/vedeu/editor/item.rb
CHANGED