vedeu 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu/all.rb +1 -2
- data/lib/vedeu/api.rb +1 -0
- data/lib/vedeu/application.rb +2 -4
- data/lib/vedeu/bindings.rb +13 -13
- data/lib/vedeu/configuration/api.rb +6 -9
- data/lib/vedeu/configuration/cli.rb +4 -7
- data/lib/vedeu/cursor/all.rb +2 -2
- data/lib/vedeu/cursor/{move_cursor.rb → move.rb} +6 -6
- data/lib/vedeu/cursor/refresh_cursor.rb +7 -4
- data/lib/vedeu/cursor/{toggle_cursor.rb → toggle.rb} +6 -8
- data/lib/vedeu/debug.rb +2 -0
- data/lib/vedeu/distributed/client.rb +1 -2
- data/lib/vedeu/distributed/server.rb +1 -1
- data/lib/vedeu/distributed/subprocess.rb +3 -2
- data/lib/vedeu/distributed/test_application.rb +2 -4
- data/lib/vedeu/dsl/all.rb +2 -0
- data/lib/vedeu/dsl/components/geometry.rb +45 -10
- data/lib/vedeu/dsl/interface.rb +1 -1
- data/lib/vedeu/events/event.rb +22 -14
- data/lib/vedeu/events/trigger.rb +6 -3
- data/lib/vedeu/geometry/all.rb +6 -1
- data/lib/vedeu/geometry/area.rb +151 -0
- data/lib/vedeu/geometry/canvas.rb +79 -0
- data/lib/vedeu/geometry/centre.rb +83 -0
- data/lib/vedeu/geometry/{content_geometry.rb → content.rb} +3 -3
- data/lib/vedeu/geometry/dimension.rb +81 -0
- data/lib/vedeu/{models → geometry}/geometry.rb +32 -0
- data/lib/vedeu/geometry/grid.rb +1 -2
- data/lib/vedeu/geometry/index_position.rb +3 -11
- data/lib/vedeu/geometry/limit.rb +1 -1
- data/lib/vedeu/geometry/position.rb +5 -0
- data/lib/vedeu/geometry/position_index.rb +3 -5
- data/lib/vedeu/geometry/position_validator.rb +1 -4
- data/lib/vedeu/input/input.rb +1 -2
- data/lib/vedeu/input/mapper.rb +2 -4
- data/lib/vedeu/launcher.rb +1 -1
- data/lib/vedeu/main_loop.rb +2 -0
- data/lib/vedeu/models/all.rb +1 -1
- data/lib/vedeu/models/cell.rb +68 -0
- data/lib/vedeu/models/interface.rb +4 -2
- data/lib/vedeu/output/all.rb +0 -1
- data/lib/vedeu/output/border.rb +6 -6
- data/lib/vedeu/output/clear.rb +6 -5
- data/lib/vedeu/output/colour.rb +1 -1
- data/lib/vedeu/output/esc.rb +2 -2
- data/lib/vedeu/output/output.rb +1 -3
- data/lib/vedeu/output/style.rb +2 -2
- data/lib/vedeu/output/text.rb +17 -1
- data/lib/vedeu/output/translator.rb +1 -8
- data/lib/vedeu/output/virtual_terminal.rb +3 -3
- data/lib/vedeu/output/wordwrap.rb +1 -1
- data/lib/vedeu/repositories/model.rb +1 -1
- data/lib/vedeu/repositories/repository.rb +1 -1
- data/lib/vedeu/support/log.rb +1 -1
- data/lib/vedeu/support/trace.rb +5 -3
- data/test/lib/vedeu/cursor/{move_cursor_test.rb → move_test.rb} +22 -22
- data/test/lib/vedeu/cursor/{toggle_cursor_test.rb → toggle_test.rb} +6 -6
- data/test/lib/vedeu/dsl/components/geometry_test.rb +14 -2
- data/test/lib/vedeu/geometry/area_test.rb +99 -0
- data/test/lib/vedeu/geometry/canvas_test.rb +66 -0
- data/test/lib/vedeu/geometry/centre_test.rb +58 -0
- data/test/lib/vedeu/geometry/{content_geometry_test.rb → content_test.rb} +3 -3
- data/test/lib/vedeu/geometry/dimension_test.rb +99 -0
- data/test/lib/vedeu/{models → geometry}/geometry_test.rb +0 -0
- data/test/lib/vedeu/geometry/index_position_test.rb +3 -9
- data/test/lib/vedeu/geometry/position_index_test.rb +2 -2
- data/test/lib/vedeu/geometry/position_test.rb +6 -0
- data/test/lib/vedeu/models/cell_test.rb +66 -0
- data/test/lib/vedeu/output/virtual_terminal_test.rb +25 -25
- data/vedeu.gemspec +3 -3
- metadata +34 -22
- data/lib/vedeu/output/char_builder.rb +0 -36
- data/test/lib/vedeu/output/char_builder_test.rb +0 -50
@@ -0,0 +1,151 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# Define an area from dimensions or points.
|
4
|
+
#
|
5
|
+
class Area
|
6
|
+
|
7
|
+
# @!attribute [r] y
|
8
|
+
# @return [Fixnum]
|
9
|
+
attr_reader :y
|
10
|
+
alias_method :top, :y
|
11
|
+
|
12
|
+
# @!attribute [r] yn
|
13
|
+
# @return [Fixnum]
|
14
|
+
attr_reader :yn
|
15
|
+
alias_method :bottom, :yn
|
16
|
+
|
17
|
+
# @!attribute [r] x
|
18
|
+
# @return [Fixnum]
|
19
|
+
attr_reader :x
|
20
|
+
alias_method :left, :x
|
21
|
+
|
22
|
+
# @!attribute [r] xn
|
23
|
+
# @return [Fixnum]
|
24
|
+
attr_reader :xn
|
25
|
+
alias_method :right, :xn
|
26
|
+
|
27
|
+
# @param y_yn [Array<Fixnum>]
|
28
|
+
# @param x_xn [Array<Fixnum>]
|
29
|
+
# @return [Vedeu::Area]
|
30
|
+
def self.from_dimensions(y_yn:, x_xn:)
|
31
|
+
new(y: y_yn.first, yn: y_yn.last, x: x_xn.first, xn: x_xn.last)
|
32
|
+
end
|
33
|
+
|
34
|
+
# @param height [Fixnum]
|
35
|
+
# @param width [Fixnum]
|
36
|
+
# @return [Vedeu::Area]
|
37
|
+
def self.from_height_and_width(height:, width:)
|
38
|
+
new(y: 1, yn: height, x: 1, xn: width)
|
39
|
+
end
|
40
|
+
|
41
|
+
# @param (see #initialize)
|
42
|
+
# @return [Vedeu::Area]
|
43
|
+
def self.from_points(y:, yn:, x:, xn:)
|
44
|
+
new(y: y, yn: yn, x: x, xn: xn)
|
45
|
+
end
|
46
|
+
|
47
|
+
# @param y [Fixnum]
|
48
|
+
# @param yn [Fixnum]
|
49
|
+
# @param x [Fixnum]
|
50
|
+
# @param xn [Fixnum]
|
51
|
+
# @return [Vedeu::Area]
|
52
|
+
def initialize(y:, yn:, x:, xn:)
|
53
|
+
@y, @yn, @x, @xn = y, yn, x, xn
|
54
|
+
end
|
55
|
+
|
56
|
+
# @param other [Vedeu::Area]
|
57
|
+
# @return [Boolean]
|
58
|
+
def ==(other)
|
59
|
+
eql?(other)
|
60
|
+
end
|
61
|
+
|
62
|
+
# @param other [Vedeu::Area]
|
63
|
+
# @return [Boolean]
|
64
|
+
def eql?(other)
|
65
|
+
self.class == other.class &&
|
66
|
+
y == other.y &&
|
67
|
+
yn == other.yn &&
|
68
|
+
x == other.x &&
|
69
|
+
xn == other.xn
|
70
|
+
end
|
71
|
+
|
72
|
+
# @return [Array<Fixnum>]
|
73
|
+
def centre
|
74
|
+
[centre_y, centre_x]
|
75
|
+
end
|
76
|
+
|
77
|
+
# @return [Fixnum]
|
78
|
+
def centre_y
|
79
|
+
((yn - y) / 2) + y
|
80
|
+
end
|
81
|
+
|
82
|
+
# @return [Fixnum]
|
83
|
+
def centre_x
|
84
|
+
((xn - x) / 2) + x
|
85
|
+
end
|
86
|
+
|
87
|
+
# Returns the row above the top by default.
|
88
|
+
#
|
89
|
+
# @example
|
90
|
+
# `top` / `y` is 4.
|
91
|
+
#
|
92
|
+
# north # => 3
|
93
|
+
# north(2) # => 2
|
94
|
+
# north(-4) # => 8
|
95
|
+
#
|
96
|
+
# @param offset [Fixnum]
|
97
|
+
# @return [Fixnum]
|
98
|
+
def north(offset = 1)
|
99
|
+
y - offset
|
100
|
+
end
|
101
|
+
|
102
|
+
# Returns the column after right by default.
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
# `right` / `xn` is 19.
|
106
|
+
#
|
107
|
+
# east # => 20
|
108
|
+
# east(2) # => 21
|
109
|
+
# east(-4) # => 15
|
110
|
+
#
|
111
|
+
# @param offset [Fixnum]
|
112
|
+
# @return [Fixnum]
|
113
|
+
def east(offset = 1)
|
114
|
+
xn + offset
|
115
|
+
end
|
116
|
+
|
117
|
+
# Returns the row below the bottom by default.
|
118
|
+
#
|
119
|
+
# @example
|
120
|
+
# `bottom` / `yn` is 12.
|
121
|
+
#
|
122
|
+
# south # => 13
|
123
|
+
# south(2) # => 14
|
124
|
+
# south(-4) # => 8
|
125
|
+
#
|
126
|
+
# @param offset [Fixnum]
|
127
|
+
# @return [Fixnum]
|
128
|
+
def south(offset = 1)
|
129
|
+
yn + offset
|
130
|
+
end
|
131
|
+
|
132
|
+
# Returns the column before left by default.
|
133
|
+
#
|
134
|
+
# @example
|
135
|
+
# `left` / `x` is 8.
|
136
|
+
#
|
137
|
+
# west # => 7
|
138
|
+
# west(2) # => 6
|
139
|
+
# west(-4) # => 12
|
140
|
+
#
|
141
|
+
# @param offset [Fixnum]
|
142
|
+
# @return [Fixnum]
|
143
|
+
def west(offset = 1)
|
144
|
+
x - offset
|
145
|
+
end
|
146
|
+
|
147
|
+
private
|
148
|
+
|
149
|
+
end # Area
|
150
|
+
|
151
|
+
end # Vedeu
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
# The size of the terminal is a limitation. Defining a canvas means we have
|
6
|
+
# more space to 'do stuff'.
|
7
|
+
#
|
8
|
+
class Canvas
|
9
|
+
|
10
|
+
include Singleton
|
11
|
+
|
12
|
+
# @return [Vedeu::Canvas]
|
13
|
+
def self.canvas
|
14
|
+
instance
|
15
|
+
end
|
16
|
+
|
17
|
+
# @param yn [Fixnum]
|
18
|
+
# @param xn [Fixnum]
|
19
|
+
# @return [Vedeu::Canvas]
|
20
|
+
def configure(yn, xn)
|
21
|
+
@yn = yn
|
22
|
+
@xn = xn
|
23
|
+
|
24
|
+
self
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [Array]
|
28
|
+
def c
|
29
|
+
[cy, cx]
|
30
|
+
end
|
31
|
+
alias_method :centre, :c
|
32
|
+
|
33
|
+
# @return [Fixnum]
|
34
|
+
def cy
|
35
|
+
((yn - y) / 2) + y
|
36
|
+
end
|
37
|
+
alias_method :centre_y, :cy
|
38
|
+
|
39
|
+
# @return [Fixnum]
|
40
|
+
def cx
|
41
|
+
((xn - x) / 2) + x
|
42
|
+
end
|
43
|
+
alias_method :centre_x, :cx
|
44
|
+
|
45
|
+
# @return [Fixnum]
|
46
|
+
def o
|
47
|
+
1
|
48
|
+
end
|
49
|
+
alias_method :origin, :o
|
50
|
+
|
51
|
+
# @return [Fixnum]
|
52
|
+
def y
|
53
|
+
1
|
54
|
+
end
|
55
|
+
alias_method :top, :y
|
56
|
+
|
57
|
+
# @return [Fixnum]
|
58
|
+
def yn
|
59
|
+
@yn
|
60
|
+
end
|
61
|
+
alias_method :bottom, :yn
|
62
|
+
alias_method :height, :yn
|
63
|
+
|
64
|
+
# @return [Fixnum]
|
65
|
+
def x
|
66
|
+
1
|
67
|
+
end
|
68
|
+
alias_method :left, :x
|
69
|
+
|
70
|
+
# @return [Fixnum]
|
71
|
+
def xn
|
72
|
+
@xn
|
73
|
+
end
|
74
|
+
alias_method :right, :xn
|
75
|
+
alias_method :width, :xn
|
76
|
+
|
77
|
+
end # Canvas
|
78
|
+
|
79
|
+
end # Vedeu
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# Return the centre character position for a value (width or height), or
|
4
|
+
# starting and ending coordinate.
|
5
|
+
#
|
6
|
+
# @example
|
7
|
+
# Vedeu::Centre.for_value(27) # => 13
|
8
|
+
#
|
9
|
+
# Vedeu::Centre.for_points(3, 17) # => 10
|
10
|
+
#
|
11
|
+
# @note
|
12
|
+
# If initialized with a `:value` in the attributes, then :v and :vn are
|
13
|
+
# ignored.
|
14
|
+
#
|
15
|
+
class Centre
|
16
|
+
|
17
|
+
# @param value [Fixnum] A width of height.
|
18
|
+
# @return [Fixnum]
|
19
|
+
def self.for_value(value)
|
20
|
+
new({ value: value }).centre
|
21
|
+
end
|
22
|
+
|
23
|
+
# @param v [Fixnum] The starting coordinate value.
|
24
|
+
# @param vn [Fixnum] The ending coordinate value.
|
25
|
+
# @return [Fixnum]
|
26
|
+
def self.for_points(v, vn)
|
27
|
+
new({ v: v, vn: vn }).centre
|
28
|
+
end
|
29
|
+
|
30
|
+
# @param attributes [Hash<Symbol => Fixnum>]
|
31
|
+
# @option attributes v [Fixnum] The starting coordinate value.
|
32
|
+
# @option attributes vn [Fixnum] The ending coordinate value.
|
33
|
+
# @option attributes value [Fixnum] A width of height.
|
34
|
+
# @return [Vedeu::Centre]
|
35
|
+
def initialize(attributes = {})
|
36
|
+
@v = attributes[:v]
|
37
|
+
@vn = attributes[:vn]
|
38
|
+
@value = attributes[:value]
|
39
|
+
end
|
40
|
+
|
41
|
+
# @raise [InvalidSyntax] When :v or :vn is missing, or :vn is less than :v.
|
42
|
+
# @return [Fixnum]
|
43
|
+
def centre
|
44
|
+
if value
|
45
|
+
value / 2
|
46
|
+
|
47
|
+
else
|
48
|
+
v + (v_vn / 2)
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
# @!attribute [r] v
|
56
|
+
# @return [Fixnum]
|
57
|
+
attr_reader :v
|
58
|
+
|
59
|
+
# @!attribute [r] vn
|
60
|
+
# @return [Fixnum]
|
61
|
+
attr_reader :vn
|
62
|
+
|
63
|
+
# @!attribute [r] value
|
64
|
+
# @return [Fixnum]
|
65
|
+
attr_reader :value
|
66
|
+
|
67
|
+
# @return [Fixnum]
|
68
|
+
def v_vn
|
69
|
+
if vn.nil? || v.nil?
|
70
|
+
fail InvalidSyntax, 'Missing values for :v, :vn.'
|
71
|
+
|
72
|
+
elsif vn < v
|
73
|
+
fail InvalidSyntax, "Values invalid for :v (#{v}), :vn (#{vn})."
|
74
|
+
|
75
|
+
else
|
76
|
+
vn - v
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
end # Centre
|
82
|
+
|
83
|
+
end # Vedeu
|
@@ -2,7 +2,7 @@ module Vedeu
|
|
2
2
|
|
3
3
|
# Provides information about the content within an interface or view.
|
4
4
|
#
|
5
|
-
class
|
5
|
+
class Content
|
6
6
|
|
7
7
|
extend Forwardable
|
8
8
|
|
@@ -18,7 +18,7 @@ module Vedeu
|
|
18
18
|
:y
|
19
19
|
|
20
20
|
# @param interface [Vedeu::Interface]
|
21
|
-
# @return [Vedeu::
|
21
|
+
# @return [Vedeu::Content]
|
22
22
|
def initialize(interface)
|
23
23
|
@interface = interface
|
24
24
|
end
|
@@ -63,6 +63,6 @@ module Vedeu
|
|
63
63
|
lines.map { |line| line.size }.max
|
64
64
|
end
|
65
65
|
|
66
|
-
end #
|
66
|
+
end # Content
|
67
67
|
|
68
68
|
end # Vedeu
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# A Dimension is either the height or width of an entity.
|
4
|
+
#
|
5
|
+
class Dimension
|
6
|
+
|
7
|
+
# @param (see #initialize)
|
8
|
+
# @return [Array<Fixnum>]
|
9
|
+
def self.pair(attributes = {})
|
10
|
+
new(attributes).pair
|
11
|
+
end
|
12
|
+
|
13
|
+
# @param attributes [Hash<Symbol => Fixnum, NilClass>]
|
14
|
+
# @option attributes d [Fixnum|NilClass] The starting value (y or x).
|
15
|
+
# @option attributes dn [Fixnum|NilClass] The ending value (yn or xn).
|
16
|
+
# @option attributes d_dn [Fixnum|NilClass] A width or a height.
|
17
|
+
# @option attributes default [Fixnum|NilClass] The terminal width or height.
|
18
|
+
# @return [Vedeu::Dimension]
|
19
|
+
def initialize(attributes = {})
|
20
|
+
@d = attributes[:d]
|
21
|
+
@dn = attributes[:dn]
|
22
|
+
@d_dn = attributes[:d_dn]
|
23
|
+
@default = attributes[:default]
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Fixnum]
|
27
|
+
def d1
|
28
|
+
dimension.first
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Fixnum]
|
32
|
+
def d2
|
33
|
+
dimension.last
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [Array<Fixnum>]
|
37
|
+
def pair
|
38
|
+
dimension
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
# @return [Array<Fixnum>]
|
44
|
+
def dimension
|
45
|
+
@dimension ||= if @d && @dn
|
46
|
+
[@d, @dn]
|
47
|
+
|
48
|
+
elsif @d && @d_dn
|
49
|
+
[@d, (@d + @d_dn)]
|
50
|
+
|
51
|
+
elsif @d_dn
|
52
|
+
[1, @d_dn]
|
53
|
+
|
54
|
+
elsif @d
|
55
|
+
[@d, @default]
|
56
|
+
|
57
|
+
else
|
58
|
+
[1, @default]
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# @!attribute [r] d
|
64
|
+
# @return [Fixnum]
|
65
|
+
attr_reader :d
|
66
|
+
|
67
|
+
# @!attribute [r] dn
|
68
|
+
# @return [Fixnum]
|
69
|
+
attr_reader :dn
|
70
|
+
|
71
|
+
# @!attribute [r] d_dn
|
72
|
+
# @return [Fixnum]
|
73
|
+
attr_reader :d_dn
|
74
|
+
|
75
|
+
# @!attribute [r] default
|
76
|
+
# @return [Fixnum]
|
77
|
+
attr_reader :default
|
78
|
+
|
79
|
+
end # Dimension
|
80
|
+
|
81
|
+
end # Vedeu
|
@@ -29,6 +29,7 @@ module Vedeu
|
|
29
29
|
#
|
30
30
|
class Geometry
|
31
31
|
|
32
|
+
extend Forwardable
|
32
33
|
include Vedeu::Model
|
33
34
|
|
34
35
|
# @!attribute [rw] centred
|
@@ -59,6 +60,14 @@ module Vedeu
|
|
59
60
|
# @return [Fixnum]
|
60
61
|
attr_writer :y
|
61
62
|
|
63
|
+
# @!attribute [w] xn
|
64
|
+
# @return [Fixnum]
|
65
|
+
attr_writer :xn
|
66
|
+
|
67
|
+
# @!attribute [w] yn
|
68
|
+
# @return [Fixnum]
|
69
|
+
attr_writer :yn
|
70
|
+
|
62
71
|
# Returns a new instance of Geometry.
|
63
72
|
#
|
64
73
|
# @param attributes [Hash]
|
@@ -266,8 +275,31 @@ module Vedeu
|
|
266
275
|
right + value
|
267
276
|
end
|
268
277
|
|
278
|
+
# def_delegators :area, :north, :east, :south, :west
|
279
|
+
|
269
280
|
private
|
270
281
|
|
282
|
+
# @return [Vedeu::Area]
|
283
|
+
def area
|
284
|
+
@area ||= Vedeu::Area.from_dimensions(y_yn, x_xn)
|
285
|
+
end
|
286
|
+
|
287
|
+
# @return [Array<Fixnum>]
|
288
|
+
def x_xn
|
289
|
+
@x_xn ||= Vedeu::Dimension.pair({ v: @x,
|
290
|
+
vn: @xn,
|
291
|
+
v_vn: @width,
|
292
|
+
default: Vedeu::Terminal.width })
|
293
|
+
end
|
294
|
+
|
295
|
+
# @return [Array<Fixnum>]
|
296
|
+
def y_yn
|
297
|
+
@y_yn ||= Vedeu::Dimension.pair({ v: @y,
|
298
|
+
vn: @yn,
|
299
|
+
v_vn: @height,
|
300
|
+
default: Vedeu::Terminal.height })
|
301
|
+
end
|
302
|
+
|
271
303
|
# The default values for a new instance of this class.
|
272
304
|
#
|
273
305
|
# @return [Hash]
|
data/lib/vedeu/geometry/grid.rb
CHANGED
@@ -7,11 +7,8 @@ module Vedeu
|
|
7
7
|
#
|
8
8
|
class IndexPosition
|
9
9
|
|
10
|
-
# @param
|
11
|
-
# @
|
12
|
-
# @param oy [Fixnum]
|
13
|
-
# @param ox [Fixnum]
|
14
|
-
# @return [Array]
|
10
|
+
# @param (see #initialize)
|
11
|
+
# @return [Vedeu::Position]
|
15
12
|
def self.[](iy, ix, oy = 1, ox = 1)
|
16
13
|
new(iy, ix, oy, ox).[]
|
17
14
|
end
|
@@ -28,13 +25,8 @@ module Vedeu
|
|
28
25
|
@ox = ox
|
29
26
|
end
|
30
27
|
|
31
|
-
# @return [Array]
|
32
|
-
def []
|
33
|
-
[y, x]
|
34
|
-
end
|
35
|
-
|
36
28
|
# @return [Vedeu::Position]
|
37
|
-
def
|
29
|
+
def []
|
38
30
|
Vedeu::Position.new(y, x)
|
39
31
|
end
|
40
32
|
|
data/lib/vedeu/geometry/limit.rb
CHANGED
@@ -15,9 +15,7 @@ module Vedeu
|
|
15
15
|
alias_method :first, :y
|
16
16
|
alias_method :last, :x
|
17
17
|
|
18
|
-
# @param
|
19
|
-
# @param x [Fixnum]
|
20
|
-
# @return [Array]
|
18
|
+
# @param (see #initialize)
|
21
19
|
def self.[](y, x)
|
22
20
|
new(y, x).[]
|
23
21
|
end
|
@@ -26,8 +24,8 @@ module Vedeu
|
|
26
24
|
# @param x [Fixnum]
|
27
25
|
# @return [Vedeu::PositionIndex]
|
28
26
|
def initialize(y, x)
|
29
|
-
@y = ((y - 1) <= 1) ?
|
30
|
-
@x = ((x - 1) <= 1) ?
|
27
|
+
@y = ((y - 1) <= 1) ? 0 : (y - 1)
|
28
|
+
@x = ((x - 1) <= 1) ? 0 : (x - 1)
|
31
29
|
end
|
32
30
|
|
33
31
|
# @return [Array]
|
@@ -40,10 +40,7 @@ module Vedeu
|
|
40
40
|
# @return [Fixnum]
|
41
41
|
attr_accessor :y
|
42
42
|
|
43
|
-
# @param
|
44
|
-
# @param x [Fixnum]
|
45
|
-
# @param y [Fixnum]
|
46
|
-
# @return [PositionValidator]
|
43
|
+
# @param (see #initialize)
|
47
44
|
def self.validate(interface, x, y)
|
48
45
|
new(interface, x, y).validate
|
49
46
|
end
|
data/lib/vedeu/input/input.rb
CHANGED
@@ -7,8 +7,7 @@ module Vedeu
|
|
7
7
|
|
8
8
|
# Instantiate Input and capture keypress(es).
|
9
9
|
#
|
10
|
-
# @param
|
11
|
-
# Vedeu::Terminal.
|
10
|
+
# @param (see #initialize)
|
12
11
|
# @return [String|Symbol]
|
13
12
|
def self.capture(reader)
|
14
13
|
new(reader).capture
|
data/lib/vedeu/input/mapper.rb
CHANGED
@@ -8,8 +8,7 @@ module Vedeu
|
|
8
8
|
# the associated action is fired, if not, we move to the next keymap or
|
9
9
|
# return false.
|
10
10
|
#
|
11
|
-
# @param
|
12
|
-
# @param name [NilClass|String]
|
11
|
+
# @param (see #initialize)
|
13
12
|
# @return [Boolean]
|
14
13
|
def self.keypress(key = nil, name = nil)
|
15
14
|
return false unless key
|
@@ -20,8 +19,7 @@ module Vedeu
|
|
20
19
|
# Checks a key is valid; i.e. not already registered to a keymap. If the
|
21
20
|
# key is registered, then the key is invalid and cannot be used again.
|
22
21
|
#
|
23
|
-
# @param
|
24
|
-
# @param name [NilClass|String]
|
22
|
+
# @param (see #initialize)
|
25
23
|
# @return [Boolean]
|
26
24
|
def self.valid?(key = nil, name = nil)
|
27
25
|
return false unless key
|
data/lib/vedeu/launcher.rb
CHANGED
data/lib/vedeu/main_loop.rb
CHANGED
@@ -12,6 +12,7 @@ module Vedeu
|
|
12
12
|
trap('TERM') { stop! }
|
13
13
|
trap('INT') { stop! }
|
14
14
|
|
15
|
+
# :nocov:
|
15
16
|
# Start the main loop.
|
16
17
|
#
|
17
18
|
# @param block [Proc]
|
@@ -30,6 +31,7 @@ module Vedeu
|
|
30
31
|
rescue VedeuInterrupt
|
31
32
|
|
32
33
|
end
|
34
|
+
# :nocov:
|
33
35
|
|
34
36
|
# Signal that we wish to terminate the running application.
|
35
37
|
#
|
data/lib/vedeu/models/all.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'vedeu/repositories/all'
|
2
2
|
|
3
|
+
require 'vedeu/models/cell'
|
3
4
|
require 'vedeu/models/char'
|
4
5
|
require 'vedeu/models/stream'
|
5
6
|
require 'vedeu/models/line'
|
@@ -7,7 +8,6 @@ require 'vedeu/models/interface'
|
|
7
8
|
require 'vedeu/models/composition'
|
8
9
|
|
9
10
|
require 'vedeu/models/focus'
|
10
|
-
require 'vedeu/models/geometry'
|
11
11
|
require 'vedeu/models/group'
|
12
12
|
require 'vedeu/models/menu'
|
13
13
|
|