vedeu 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/TODO.md +4 -0
  3. data/docs/dsl.md +1 -11
  4. data/docs/dsl/by_method/geometry/align.md +1 -0
  5. data/docs/dsl/by_method/geometry/align_bottom.md +40 -0
  6. data/docs/dsl/by_method/geometry/align_centre.md +40 -0
  7. data/docs/dsl/by_method/geometry/align_left.md +40 -0
  8. data/docs/dsl/by_method/geometry/align_middle.md +40 -0
  9. data/docs/dsl/by_method/geometry/align_right.md +40 -0
  10. data/docs/dsl/by_method/geometry/align_top.md +40 -0
  11. data/docs/dsl/by_method/geometry/columns.md +1 -0
  12. data/docs/dsl/by_method/geometry/height.md +0 -0
  13. data/docs/dsl/by_method/geometry/horizontal_alignment.md +1 -0
  14. data/docs/dsl/by_method/geometry/rows.md +1 -0
  15. data/docs/dsl/by_method/geometry/vertical_alignment.md +1 -0
  16. data/docs/dsl/by_method/geometry/width.md +0 -0
  17. data/docs/dsl/by_method/geometry/x.md +1 -0
  18. data/docs/dsl/by_method/geometry/xn.md +1 -0
  19. data/docs/dsl/by_method/geometry/y.md +1 -0
  20. data/docs/dsl/by_method/geometry/yn.md +1 -0
  21. data/docs/dsl/by_method/render.md +5 -1
  22. data/docs/dsl/by_method/renders.md +31 -1
  23. data/docs/dsl/by_method/view.md +26 -0
  24. data/docs/dsl/by_method/view/stream.md +18 -0
  25. data/docs/dsl/by_method/views.md +32 -1
  26. data/docs/events/by_name/set_border_caption.md +2 -4
  27. data/docs/events/by_name/set_border_title.md +2 -4
  28. data/examples/views/empty_template.rb +0 -4
  29. data/examples/views/full_screen.rb +30 -5
  30. data/examples/views/misc_view.rb +464 -0
  31. data/examples/views/wordwrap.rb +72 -0
  32. data/examples/views/wordwrap.txt +8 -0
  33. data/integrations/dsl_app_021.rb +127 -0
  34. data/integrations/dsl_app_022.rb +133 -0
  35. data/integrations/expected/342_streams.out +1 -1
  36. data/integrations/expected/dsl_app_001.out +1 -1
  37. data/integrations/expected/dsl_app_002.out +1 -1
  38. data/integrations/expected/dsl_app_003.out +1 -1
  39. data/integrations/expected/dsl_app_004.out +1 -1
  40. data/integrations/expected/dsl_app_005.out +1 -1
  41. data/integrations/expected/dsl_app_006.out +1 -1
  42. data/integrations/expected/dsl_app_007.out +1 -1
  43. data/integrations/expected/dsl_app_008.out +1 -1
  44. data/integrations/expected/dsl_app_009.out +1 -1
  45. data/integrations/expected/dsl_app_010.out +1 -1
  46. data/integrations/expected/dsl_app_011.out +1 -1
  47. data/integrations/expected/dsl_app_012.out +1 -1
  48. data/integrations/expected/dsl_app_013.out +1 -1
  49. data/integrations/expected/dsl_app_014.out +1 -1
  50. data/integrations/expected/dsl_app_015.out +1 -1
  51. data/integrations/expected/dsl_app_016.out +1 -1
  52. data/integrations/expected/dsl_app_021.out +1 -0
  53. data/integrations/expected/dsl_app_022.out +1 -0
  54. data/integrations/support/test_interface_021.rb +7 -0
  55. data/integrations/support/test_interface_022.rb +15 -0
  56. data/lib/vedeu/all.rb +4 -2
  57. data/lib/vedeu/borders/border.rb +22 -6
  58. data/lib/vedeu/borders/repository.rb +4 -8
  59. data/lib/vedeu/buffers/buffer.rb +9 -6
  60. data/lib/vedeu/buffers/empty.rb +26 -23
  61. data/lib/vedeu/buffers/view.rb +44 -41
  62. data/lib/vedeu/cells/cursor.rb +0 -2
  63. data/lib/vedeu/cells/empty.rb +0 -1
  64. data/lib/vedeu/cells/escape.rb +0 -2
  65. data/lib/vedeu/coercers/alignment.rb +58 -8
  66. data/lib/vedeu/coercers/horizontal_alignment.rb +13 -9
  67. data/lib/vedeu/coercers/vertical_alignment.rb +13 -8
  68. data/lib/vedeu/common.rb +1 -1
  69. data/lib/vedeu/configuration/configuration.rb +41 -3
  70. data/lib/vedeu/cursors/coordinate.rb +1 -3
  71. data/lib/vedeu/cursors/cursor.rb +2 -6
  72. data/lib/vedeu/dsl/all.rb +1 -2
  73. data/lib/vedeu/dsl/border.rb +6 -6
  74. data/lib/vedeu/dsl/elements.rb +2 -2
  75. data/lib/vedeu/dsl/geometry.rb +7 -7
  76. data/lib/vedeu/dsl/{string → helpers}/align.rb +0 -0
  77. data/lib/vedeu/dsl/helpers/all.rb +17 -0
  78. data/lib/vedeu/dsl/{attributes.rb → helpers/attributes.rb} +0 -0
  79. data/lib/vedeu/dsl/{string → helpers}/text.rb +0 -0
  80. data/lib/vedeu/dsl/{string → helpers}/truncate.rb +0 -0
  81. data/lib/vedeu/dsl/{string → helpers}/wordwrap.rb +0 -0
  82. data/lib/vedeu/dsl/view.rb +11 -19
  83. data/lib/vedeu/dsl/views.rb +16 -106
  84. data/lib/vedeu/geometries/all.rb +0 -1
  85. data/lib/vedeu/geometries/area/area.rb +6 -12
  86. data/lib/vedeu/geometries/area/dimension.rb +21 -44
  87. data/lib/vedeu/geometries/dsl/all.rb +0 -1
  88. data/lib/vedeu/geometries/dsl/dsl.rb +22 -31
  89. data/lib/vedeu/geometries/geometry.rb +6 -0
  90. data/lib/vedeu/geometries/position.rb +6 -3
  91. data/lib/vedeu/geometries/repository.rb +1 -1
  92. data/lib/vedeu/input/mouse.rb +1 -0
  93. data/lib/vedeu/logging/log.rb +3 -6
  94. data/lib/vedeu/menus/dsl.rb +4 -5
  95. data/lib/vedeu/output/compressor.rb +11 -1
  96. data/lib/vedeu/output/viewport.rb +59 -59
  97. data/lib/vedeu/presentation/all.rb +1 -2
  98. data/lib/vedeu/presentation/colour.rb +75 -3
  99. data/lib/vedeu/{geometries/positionable.rb → presentation/position.rb} +4 -4
  100. data/lib/vedeu/presentation/presentation.rb +1 -3
  101. data/lib/vedeu/presentation/styles.rb +16 -1
  102. data/lib/vedeu/repositories/all.rb +0 -1
  103. data/lib/vedeu/sentence.rb +91 -0
  104. data/lib/vedeu/support/point.rb +72 -0
  105. data/lib/vedeu/terminal/terminal.rb +11 -53
  106. data/lib/vedeu/version.rb +1 -1
  107. data/lib/vedeu/views/composition.rb +11 -1
  108. data/lib/vedeu/views/default_attributes.rb +2 -0
  109. data/lib/vedeu/views/line.rb +16 -1
  110. data/lib/vedeu/views/stream.rb +16 -1
  111. data/lib/vedeu/views/view.rb +25 -17
  112. data/test/lib/vedeu/borders/border_test.rb +20 -2
  113. data/test/lib/vedeu/buffers/buffer_test.rb +15 -2
  114. data/test/lib/vedeu/buffers/empty_test.rb +51 -18
  115. data/test/lib/vedeu/buffers/view_test.rb +2 -2
  116. data/test/lib/vedeu/coercers/alignment_test.rb +32 -0
  117. data/test/lib/vedeu/coercers/horizontal_alignment_test.rb +16 -0
  118. data/test/lib/vedeu/coercers/vertical_alignment_test.rb +16 -0
  119. data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
  120. data/test/lib/vedeu/cursors/dsl_test.rb +35 -21
  121. data/test/lib/vedeu/dsl/elements_test.rb +94 -2
  122. data/test/lib/vedeu/dsl/{string → helpers}/align_test.rb +0 -0
  123. data/test/lib/vedeu/dsl/{attributes_test.rb → helpers/attributes_test.rb} +0 -0
  124. data/test/lib/vedeu/dsl/{string → helpers}/text_test.rb +0 -0
  125. data/test/lib/vedeu/dsl/{string → helpers}/truncate_test.rb +0 -0
  126. data/test/lib/vedeu/dsl/{string → helpers}/wordwrap_test.rb +0 -0
  127. data/test/lib/vedeu/dsl/view_test.rb +22 -4
  128. data/test/lib/vedeu/dsl/views_test.rb +8 -5
  129. data/test/lib/vedeu/geometries/dsl/dsl_test.rb +2 -159
  130. data/test/lib/vedeu/geometries/position_test.rb +118 -60
  131. data/test/lib/vedeu/input/mouse_test.rb +1 -6
  132. data/test/lib/vedeu/logging/log_test.rb +14 -3
  133. data/test/lib/vedeu/presentation/colour_test.rb +77 -0
  134. data/test/lib/vedeu/{geometries/positionable_test.rb → presentation/position_test.rb} +4 -4
  135. data/test/lib/vedeu/sentence_test.rb +49 -0
  136. data/test/lib/vedeu/support/point_test.rb +139 -0
  137. data/test/lib/vedeu/terminal/terminal_test.rb +3 -44
  138. data/test/lib/vedeu/views/composition_test.rb +24 -4
  139. data/test/lib/vedeu/views/default_attributes_test.rb +10 -2
  140. data/test/lib/vedeu/views/view_test.rb +8 -15
  141. data/test/support/examples/material_colours_app.rb +0 -6
  142. data/vedeu.gemspec +1 -1
  143. metadata +58 -38
  144. data/examples/views/lines_line_stream.rb +0 -95
  145. data/examples/views/lines_line_streams.rb +0 -75
  146. data/examples/views/lines_line_streams_stream.rb +0 -78
  147. data/examples/views/lines_line_streams_stream_stream.rb +0 -50
  148. data/examples/views/lines_streams.rb +0 -93
  149. data/lib/vedeu/dsl/string/all.rb +0 -16
  150. data/lib/vedeu/geometries/dsl/validator.rb +0 -62
  151. data/lib/vedeu/presentation/background.rb +0 -54
  152. data/lib/vedeu/presentation/foreground.rb +0 -54
  153. data/lib/vedeu/repositories/parent.rb +0 -34
  154. data/test/lib/vedeu/geometries/dsl/validator_test.rb +0 -85
  155. data/test/lib/vedeu/presentation/background_test.rb +0 -74
  156. data/test/lib/vedeu/presentation/foreground_test.rb +0 -75
@@ -21,5 +21,4 @@ require 'vedeu/geometries/dsl/all'
21
21
  require 'vedeu/geometries/geometry'
22
22
  require 'vedeu/geometries/move'
23
23
  require 'vedeu/geometries/position'
24
- require 'vedeu/geometries/positionable'
25
24
  require 'vedeu/geometries/repository'
@@ -70,14 +70,14 @@ module Vedeu
70
70
  d_dn: attributes[:width],
71
71
  maximised: attributes[:maximised],
72
72
  }
73
- height = Vedeu::Geometries::YDimension.pair(y_attributes)
74
- width = Vedeu::Geometries::XDimension.pair(x_attributes)
73
+ dy, dyn = Vedeu::Geometries::YDimension.pair(y_attributes)
74
+ dx, dxn = Vedeu::Geometries::XDimension.pair(x_attributes)
75
75
 
76
76
  new(name: attributes[:name],
77
- y: height[0],
78
- yn: height[-1],
79
- x: width[0],
80
- xn: width[-1])
77
+ y: dy,
78
+ yn: dyn,
79
+ x: dx,
80
+ xn: dxn)
81
81
  end
82
82
 
83
83
  # Returns a new instance of Vedeu::Area.
@@ -205,9 +205,6 @@ module Vedeu
205
205
  # @return [Fixnum]
206
206
  def height
207
207
  (yn - y) + 1
208
-
209
- # (yn - y) + 2
210
- # (y..yn).size# + 1
211
208
  end
212
209
 
213
210
  # Returns the width of the interface.
@@ -215,9 +212,6 @@ module Vedeu
215
212
  # @return [Fixnum]
216
213
  def width
217
214
  (xn - x) + 1
218
-
219
- # (xn - x) + 2
220
- # (x..xn).size# + 1
221
215
  end
222
216
 
223
217
  # Returns the row above the top by default.
@@ -46,11 +46,30 @@ module Vedeu
46
46
  end
47
47
  end
48
48
 
49
- # Fetch the coordinates.
49
+ # Return the coordinate pair.
50
+ #
51
+ # 1) If maximised, it will be from the first row/line or column/
52
+ # character to the last row/line or column/character of the
53
+ # terminal.
50
54
  #
51
55
  # @return [Array<Fixnum>]
52
56
  def pair
53
- dimension
57
+ if maximised?
58
+ [1, default]
59
+
60
+ elsif bottom_aligned? || right_aligned?
61
+ [start_coordinate, default]
62
+
63
+ elsif centre_aligned? || middle_aligned?
64
+ [centred_d, centred_dn]
65
+
66
+ elsif left_aligned? || top_aligned?
67
+ [1, end_coordinate]
68
+
69
+ else
70
+ [_d, _dn]
71
+
72
+ end
54
73
  end
55
74
 
56
75
  protected
@@ -83,43 +102,6 @@ module Vedeu
83
102
  @_alignment ||= Vedeu::Coercers::Alignment.coerce(@alignment)
84
103
  end
85
104
 
86
- # Return the dimension.
87
- #
88
- # 1) If maximised, it will be from the first row/line or column/
89
- # character to the last row/line or column/character of the
90
- # terminal.
91
- # 2) If centred,
92
- #
93
- # @return [Array<Fixnum>]
94
- def dimension
95
- @dimension = if maximised?
96
- [1, default]
97
-
98
- elsif bottom_aligned? || right_aligned?
99
- [start_coordinate, default]
100
-
101
- elsif centre_aligned? || middle_aligned?
102
- [centred_d, centred_dn]
103
-
104
- elsif left_aligned? || top_aligned?
105
- [1, end_coordinate]
106
-
107
- else
108
- [_d, _dn]
109
-
110
- end
111
- end
112
-
113
- # Return a boolean indicating we know the length if a we know
114
- # either the terminal width or height, or we can determine a
115
- # length from the values provided.
116
- #
117
- # @return [Boolean]
118
- # @todo Investigate: should this be && or ||. (GL: 2015-10-16)
119
- def length?
120
- default && length
121
- end
122
-
123
105
  # Provide the number of rows/lines or columns/characters.
124
106
  #
125
107
  # 1) Use the starting (x or y) and ending (xn or yn) values.
@@ -227,23 +209,18 @@ module Vedeu
227
209
  # @return [Fixnum]
228
210
  def _dn
229
211
  if dn
230
- # fail "_dn 1 v:#{d} #{dn}"
231
212
  dn
232
213
 
233
214
  elsif d.nil? && d_dn
234
- # fail "_dn 2 v:#{d_dn}"
235
215
  d_dn
236
216
 
237
217
  elsif d && d_dn
238
- # fail "_dn 3 v:#{d} #{d_dn}"
239
218
  (d + d_dn) - 1
240
219
 
241
220
  elsif default
242
- # fail "_dn 4 v:#{default}"
243
221
  default
244
222
 
245
223
  else
246
- # fail "_dn 5 v:1"
247
224
  1
248
225
 
249
226
  end
@@ -9,5 +9,4 @@ module Vedeu
9
9
  end # Vedeu
10
10
 
11
11
  require 'vedeu/geometries/dsl/grid'
12
- require 'vedeu/geometries/dsl/validator'
13
12
  require 'vedeu/geometries/dsl/dsl'
@@ -75,10 +75,10 @@ module Vedeu
75
75
  #
76
76
  class DSL
77
77
 
78
+ include Vedeu::Common
78
79
  include Vedeu::DSL
79
80
  include Vedeu::DSL::Geometry
80
81
  include Vedeu::DSL::Use
81
- include Vedeu::Geometries::Validator
82
82
 
83
83
  # Align the interface/view horizontally or vertically within
84
84
  # the terminal.
@@ -100,12 +100,7 @@ module Vedeu
100
100
  # - When the vertical is given (and not :none) and the height
101
101
  # is not given.
102
102
  # @return [Vedeu::Geometries::Geometry]
103
- def align(vertical, horizontal, width, height)
104
- validate_vertical_alignment!(vertical)
105
- validate_horizontal_alignment!(horizontal)
106
- validate_height!(height) unless vertical == :none
107
- validate_width!(width) unless horizontal == :none
108
-
103
+ def align(vertical: :none, horizontal: :none, width: nil, height: nil)
109
104
  horizontal_alignment(horizontal, width)
110
105
  vertical_alignment(vertical, height)
111
106
  end
@@ -114,26 +109,22 @@ module Vedeu
114
109
  # :right.
115
110
  # @param width [Fixnum] The number of characters/columns.
116
111
  # @return [Vedeu::Geometries::Geometry]
117
- def horizontal_alignment(value, width)
118
- validate_horizontal_alignment!(value)
119
- validate_width!(width)
112
+ def horizontal_alignment(value = :none, width = nil)
113
+ alignment = Vedeu::Coercers::HorizontalAlignment.validate(value)
120
114
 
121
- model.horizontal_alignment = Vedeu::Coercers::HorizontalAlignment
122
- .coerce(value)
123
- model.width = width
115
+ model.width = width if width
116
+ model.horizontal_alignment = alignment
124
117
  model
125
118
  end
126
119
 
127
120
  # @param value [Symbol] One of :bottom, :middle, :none, :top.
128
121
  # @param height [Fixnum] The number of lines/rows.
129
122
  # @return [Vedeu::Geometries::Geometry]
130
- def vertical_alignment(value, height)
131
- validate_vertical_alignment!(value)
132
- validate_height!(height)
123
+ def vertical_alignment(value = :none, height = nil)
124
+ alignment = Vedeu::Coercers::VerticalAlignment.validate(value)
133
125
 
134
- model.vertical_alignment = Vedeu::Coercers::VerticalAlignment
135
- .coerce(value)
136
- model.height = height
126
+ model.height = height if height
127
+ model.vertical_alignment = alignment
137
128
  model
138
129
  end
139
130
 
@@ -148,7 +139,7 @@ module Vedeu
148
139
  # # vertical_alignment(:bottom, 30)
149
140
  #
150
141
  # # or you can use: (see notes)
151
- # # align(:bottom, :none, Vedeu.width, 30)
142
+ # # align(vertical: :bottom, height: 30)
152
143
  #
153
144
  # # ... some code
154
145
  # end
@@ -161,7 +152,7 @@ module Vedeu
161
152
  # @raise [Vedeu::Error::InvalidSyntax] When the height is not
162
153
  # given.
163
154
  # @return [Vedeu::Geometries::Geometry]
164
- def align_bottom(height)
155
+ def align_bottom(height = nil)
165
156
  vertical_alignment(:bottom, height)
166
157
  end
167
158
 
@@ -175,7 +166,7 @@ module Vedeu
175
166
  # # horizontal_alignment(:centre, 30)
176
167
  #
177
168
  # # or you can use: (see notes)
178
- # # align(:none, :centre, 30, Vedeu.height)
169
+ # # align(horizontal: :centre, width: 30)
179
170
  #
180
171
  # # ... some code
181
172
  # end
@@ -190,7 +181,7 @@ module Vedeu
190
181
  # @raise [Vedeu::Error::InvalidSyntax] When the width is not
191
182
  # given.
192
183
  # @return [Vedeu::Geometries::Geometry]
193
- def align_centre(width)
184
+ def align_centre(width = nil)
194
185
  horizontal_alignment(:centre, width)
195
186
  end
196
187
  alias_method :align_center, :align_centre
@@ -205,7 +196,7 @@ module Vedeu
205
196
  # # horizontal_alignment(:left, 30)
206
197
  #
207
198
  # # or you can use: (see notes)
208
- # # align(:none, :left, 30, Vedeu.height)
199
+ # # align(horizontal: :left, width: 30)
209
200
  #
210
201
  # # ... some code
211
202
  # end
@@ -218,7 +209,7 @@ module Vedeu
218
209
  # @raise [Vedeu::Error::InvalidSyntax] When the width is not
219
210
  # given.
220
211
  # @return [Vedeu::Geometries::Geometry]
221
- def align_left(width)
212
+ def align_left(width = nil)
222
213
  horizontal_alignment(:left, width)
223
214
  end
224
215
 
@@ -233,7 +224,7 @@ module Vedeu
233
224
  # # vertical_alignment(:middle, 30)
234
225
  #
235
226
  # # or you can use: (see notes)
236
- # # align(:middle, :none, Vedeu.width, 30)
227
+ # # align(vertical: :middle, height: 30)
237
228
  #
238
229
  # # ... some code
239
230
  # end
@@ -246,7 +237,7 @@ module Vedeu
246
237
  # @raise [Vedeu::Error::InvalidSyntax] When the height is not
247
238
  # given.
248
239
  # @return [Vedeu::Geometries::Geometry]
249
- def align_middle(height)
240
+ def align_middle(height = nil)
250
241
  vertical_alignment(:middle, height)
251
242
  end
252
243
 
@@ -260,7 +251,7 @@ module Vedeu
260
251
  # # horizontal_alignment(:right, 30)
261
252
  #
262
253
  # # or you can use: (see notes)
263
- # # align(:none, :right, 30, Vedeu.height)
254
+ # # align(horizontal: :right, width: 30)
264
255
  #
265
256
  # # ... some code
266
257
  # end
@@ -273,7 +264,7 @@ module Vedeu
273
264
  # @raise [Vedeu::Error::InvalidSyntax] When the width is not
274
265
  # given.
275
266
  # @return [Vedeu::Geometries::Geometry]
276
- def align_right(width)
267
+ def align_right(width = nil)
277
268
  horizontal_alignment(:right, width)
278
269
  end
279
270
 
@@ -288,7 +279,7 @@ module Vedeu
288
279
  # # vertical_alignment(:top, 30)
289
280
  #
290
281
  # # or you can use: (see notes)
291
- # # align(:top, :none, Vedeu.width, 30)
282
+ # # align(vertical: :top, height: 30)
292
283
  #
293
284
  # # ... some code
294
285
  # end
@@ -301,7 +292,7 @@ module Vedeu
301
292
  # @raise [Vedeu::Error::InvalidSyntax] When the height is not
302
293
  # given.
303
294
  # @return [Vedeu::Geometries::Geometry]
304
- def align_top(height)
295
+ def align_top(height = nil)
305
296
  vertical_alignment(:top, height)
306
297
  end
307
298
 
@@ -189,6 +189,12 @@ module Vedeu
189
189
 
190
190
  private
191
191
 
192
+ # @todo Investigate the differences between memoizing this and
193
+ # not memoizing. Memoizing saves ~80ms on running test suite
194
+ # and considerably impacts app responsiveness, however changes
195
+ # to the geometry (such as movement or maximising) are not
196
+ # reflected. (GL: 2016-01-11)
197
+ #
192
198
  # @return [Vedeu::Geometries::Area]
193
199
  def area
194
200
  Vedeu::Geometries::Area.from_attributes(area_attributes)
@@ -44,6 +44,9 @@ module Vedeu
44
44
  elsif value.is_a?(Hash)
45
45
  new(value.fetch(:y, 1), value.fetch(:x, 1))
46
46
 
47
+ elsif value.is_a?(NilClass)
48
+ nil
49
+
47
50
  end
48
51
  end
49
52
 
@@ -53,8 +56,8 @@ module Vedeu
53
56
  # @param x [Fixnum] The column/character position.
54
57
  # @return [Vedeu::Geometries::Position]
55
58
  def initialize(y = 1, x = 1)
56
- @y = (y.nil? || y < 1) ? 1 : y
57
- @x = (x.nil? || x < 1) ? 1 : x
59
+ @y = Vedeu::Point.coerce(value: y, max: Vedeu.height).value
60
+ @x = Vedeu::Point.coerce(value: x, max: Vedeu.width).value
58
61
 
59
62
  freeze
60
63
  end
@@ -87,7 +90,7 @@ module Vedeu
87
90
  # @param other [Vedeu::Geometries::Position]
88
91
  # @return [Boolean]
89
92
  def eql?(other)
90
- self.class == other.class && (x == other.x && y == other.y)
93
+ self.class == other.class && x == other.x && y == other.y
91
94
  end
92
95
  alias_method :==, :eql?
93
96
 
@@ -11,7 +11,7 @@ module Vedeu
11
11
 
12
12
  singleton_class.send(:alias_method, :geometries, :repository)
13
13
 
14
- null Vedeu::Geometries::Geometry, height: Vedeu.height, width: Vedeu.width
14
+ null Vedeu::Geometries::Geometry
15
15
  real Vedeu::Geometries::Geometry
16
16
 
17
17
  end # Repository
@@ -48,6 +48,7 @@ module Vedeu
48
48
  message: 'Vedeu does not support mouse button ' \
49
49
  "'#{button}' yet.")
50
50
 
51
+ false
51
52
  end
52
53
  end
53
54
 
@@ -26,14 +26,11 @@ module Vedeu
26
26
  #
27
27
  # @return [String]
28
28
  def log(message:, force: false, type: :info)
29
- output = log_entry(type, message)
30
-
31
- if (Vedeu.config.log? || force) &&
32
- Vedeu.config.loggable?(type)
29
+ if (Vedeu.config.log? || force) && Vedeu.config.loggable?(type)
30
+ output = log_entry(type, message)
33
31
  logger.debug(output)
32
+ output
34
33
  end
35
-
36
- output
37
34
  end
38
35
 
39
36
  # Write a message to STDOUT.
@@ -20,8 +20,7 @@ module Vedeu
20
20
  # @param name [String|Symbol] The name of the interface or
21
21
  # view to which this menu belongs.
22
22
  # @param block [Proc] A set of attributes which define the
23
- # features of the menu. See {Vedeu::Menus::DSL#items} and
24
- # {Vedeu::Menus::DSL#name}.
23
+ # features of the menu.
25
24
  #
26
25
  # @example
27
26
  # Vedeu.menu :my_interface do
@@ -35,9 +34,9 @@ module Vedeu
35
34
  # # ...
36
35
  # end
37
36
  #
38
- # @raise [Vedeu::Error::MissingRequired|
39
- # Vedeu::Error::RequiresBlock] When a name or block
40
- # respectively are not given.
37
+ # @macro raise_requires_block
38
+ # @raise [Vedeu::Error::MissingRequired] When a name is not
39
+ # given.
41
40
  # @return [API::Menu]
42
41
  def menu(name, &block)
43
42
  fail Vedeu::Error::MissingRequired unless name
@@ -84,15 +84,25 @@ module Vedeu
84
84
  def compress
85
85
  message = "Compression for #{content.size} objects"
86
86
 
87
+ @same = ''
87
88
  @compress ||= Vedeu.timer(message) do
88
89
  out = content.map do |cell|
89
- [
90
+ rendered = [
90
91
  # position_for(cell),
91
92
  cell.position.to_s,
92
93
  colour_for(cell),
93
94
  style_for(cell),
94
95
  cell.value,
95
96
  ].join
97
+
98
+ if @same == rendered
99
+ next
100
+
101
+ else
102
+ @same = rendered
103
+ @same
104
+
105
+ end
96
106
  end.join
97
107
 
98
108
  Vedeu.log(type: :compress,