vedeu 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +40 -0
  3. data/README.md +1 -0
  4. data/docs/dsl.md +24 -24
  5. data/lib/vedeu/all.rb +21 -44
  6. data/lib/vedeu/api.rb +13 -13
  7. data/lib/vedeu/application/application_controller.rb +2 -0
  8. data/lib/vedeu/bindings/movement.rb +53 -18
  9. data/lib/vedeu/bindings/refresh.rb +1 -1
  10. data/lib/vedeu/bindings/system.rb +2 -2
  11. data/lib/vedeu/bindings/visibility.rb +3 -3
  12. data/lib/vedeu/borders/all.rb +13 -0
  13. data/lib/vedeu/borders/border.rb +209 -202
  14. data/lib/vedeu/{dsl/border.rb → borders/dsl.rb} +15 -15
  15. data/lib/vedeu/{null/border.rb → borders/null.rb} +9 -9
  16. data/lib/vedeu/borders/render.rb +347 -0
  17. data/lib/vedeu/borders/repository.rb +19 -0
  18. data/lib/vedeu/buffers/all.rb +13 -0
  19. data/lib/vedeu/buffers/buffer.rb +182 -176
  20. data/lib/vedeu/{null/buffer.rb → buffers/null.rb} +8 -8
  21. data/lib/vedeu/buffers/repository.rb +24 -0
  22. data/lib/vedeu/buffers/virtual_buffer.rb +2 -2
  23. data/lib/vedeu/cursors/all.rb +11 -0
  24. data/lib/vedeu/cursors/cursor.rb +276 -0
  25. data/lib/vedeu/cursors/refresh.rb +84 -0
  26. data/lib/vedeu/cursors/repository.rb +34 -0
  27. data/lib/vedeu/dsl/interface.rb +9 -9
  28. data/lib/vedeu/dsl/shared.rb +11 -11
  29. data/lib/vedeu/{exceptions.rb → error.rb} +2 -2
  30. data/lib/vedeu/esc/esc.rb +1 -1
  31. data/lib/vedeu/geometry/all.rb +18 -0
  32. data/lib/vedeu/geometry/area.rb +170 -160
  33. data/lib/vedeu/geometry/coordinate.rb +61 -39
  34. data/lib/vedeu/geometry/dimension.rb +139 -132
  35. data/lib/vedeu/{dsl/geometry.rb → geometry/dsl.rb} +11 -11
  36. data/lib/vedeu/geometry/generic_coordinate.rb +159 -153
  37. data/lib/vedeu/geometry/geometry.rb +310 -212
  38. data/lib/vedeu/geometry/grid.rb +73 -69
  39. data/lib/vedeu/{null/geometry.rb → geometry/null.rb} +10 -10
  40. data/lib/vedeu/geometry/position.rb +124 -120
  41. data/lib/vedeu/geometry/repository.rb +19 -0
  42. data/lib/vedeu/input/editor/document.rb +2 -2
  43. data/lib/vedeu/internal_api.rb +8 -8
  44. data/lib/vedeu/models/escape.rb +2 -2
  45. data/lib/vedeu/models/interface.rb +1 -1
  46. data/lib/vedeu/models/page.rb +89 -0
  47. data/lib/vedeu/models/row.rb +66 -0
  48. data/lib/vedeu/models/toggleable.rb +1 -1
  49. data/lib/vedeu/models/views/char.rb +7 -6
  50. data/lib/vedeu/models/views/line.rb +1 -1
  51. data/lib/vedeu/models/views/view.rb +2 -2
  52. data/lib/vedeu/options.rb +19 -0
  53. data/lib/vedeu/output/clear/named_interface.rb +1 -1
  54. data/lib/vedeu/output/direct.rb +1 -1
  55. data/lib/vedeu/output/presentation.rb +2 -1
  56. data/lib/vedeu/output/viewport.rb +3 -3
  57. data/lib/vedeu/repositories/model.rb +9 -1
  58. data/lib/vedeu/repositories/repository.rb +5 -0
  59. data/lib/vedeu/terminal/terminal.rb +3 -3
  60. data/lib/vedeu/version.rb +1 -1
  61. data/test/lib/vedeu/borders/border_test.rb +299 -291
  62. data/test/lib/vedeu/{dsl/border_test.rb → borders/dsl_test.rb} +6 -6
  63. data/test/lib/vedeu/{null/border_test.rb → borders/null_test.rb} +6 -6
  64. data/test/lib/vedeu/borders/render_test.rb +125 -0
  65. data/test/lib/vedeu/borders/repository_test.rb +17 -0
  66. data/test/lib/vedeu/buffers/buffer_test.rb +116 -112
  67. data/test/lib/vedeu/{null/buffer_test.rb → buffers/null_test.rb} +5 -5
  68. data/test/lib/vedeu/buffers/repository_test.rb +18 -0
  69. data/test/lib/vedeu/cursors/cursor_test.rb +370 -0
  70. data/test/lib/vedeu/cursors/refresh_test.rb +69 -0
  71. data/test/lib/vedeu/cursors/repository_test.rb +41 -0
  72. data/test/lib/vedeu/dsl/interface_test.rb +5 -5
  73. data/test/lib/vedeu/{exceptions_test.rb → error_test.rb} +0 -0
  74. data/test/lib/vedeu/geometry/area_test.rb +141 -137
  75. data/test/lib/vedeu/geometry/coordinate_test.rb +93 -89
  76. data/test/lib/vedeu/geometry/dimension_test.rb +137 -133
  77. data/test/lib/vedeu/{dsl/geometry_test.rb → geometry/dsl_test.rb} +17 -17
  78. data/test/lib/vedeu/geometry/generic_coordinate_test.rb +32 -28
  79. data/test/lib/vedeu/geometry/geometry_test.rb +282 -157
  80. data/test/lib/vedeu/geometry/grid_test.rb +35 -31
  81. data/test/lib/vedeu/{null/geometry_test.rb → geometry/null_test.rb} +5 -5
  82. data/test/lib/vedeu/geometry/position_test.rb +146 -142
  83. data/test/lib/vedeu/geometry/repository_test.rb +19 -0
  84. data/test/lib/vedeu/input/editor/document_test.rb +1 -1
  85. data/test/lib/vedeu/models/escape_test.rb +1 -1
  86. data/test/lib/vedeu/models/interface_test.rb +2 -2
  87. data/test/lib/vedeu/models/page_test.rb +235 -0
  88. data/test/lib/vedeu/models/row_test.rb +111 -0
  89. data/test/lib/vedeu/models/views/char_test.rb +3 -3
  90. data/test/lib/vedeu/options_test.rb +57 -0
  91. data/test/lib/vedeu/output/clear/named_interface_test.rb +1 -1
  92. data/test/lib/vedeu/output/renderers/json_test.rb +1 -1
  93. data/test/lib/vedeu/output/viewport_test.rb +15 -9
  94. data/test/lib/vedeu/refresh/refresh_buffer_test.rb +12 -12
  95. data/test/lib/vedeu/repositories/repositories_test.rb +1 -1
  96. data/test/lib/vedeu/repositories/repository_test.rb +7 -0
  97. data/test/lib/vedeu/terminal/terminal_test.rb +1 -1
  98. data/test/test_helper.rb +1 -1
  99. data/vedeu.gemspec +2 -2
  100. metadata +57 -63
  101. data/lib/vedeu/borders/borders.rb +0 -15
  102. data/lib/vedeu/borders/render_border.rb +0 -331
  103. data/lib/vedeu/buffers/buffers.rb +0 -20
  104. data/lib/vedeu/cursor/cursor.rb +0 -174
  105. data/lib/vedeu/cursor/cursors.rb +0 -30
  106. data/lib/vedeu/cursor/move.rb +0 -239
  107. data/lib/vedeu/cursor/reposition.rb +0 -78
  108. data/lib/vedeu/geometry/geometries.rb +0 -15
  109. data/lib/vedeu/refresh/refresh_cursor.rb +0 -92
  110. data/test/lib/vedeu/borders/borders_test.rb +0 -13
  111. data/test/lib/vedeu/borders/render_border_test.rb +0 -121
  112. data/test/lib/vedeu/buffers/buffers_test.rb +0 -14
  113. data/test/lib/vedeu/cursor/cursor_test.rb +0 -246
  114. data/test/lib/vedeu/cursor/cursors_test.rb +0 -37
  115. data/test/lib/vedeu/cursor/move_test.rb +0 -301
  116. data/test/lib/vedeu/cursor/reposition_test.rb +0 -63
  117. data/test/lib/vedeu/geometry/geometries_test.rb +0 -15
  118. data/test/lib/vedeu/refresh/refresh_cursor_test.rb +0 -65
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db7557217b4f94e3fcfea2f541421306550f35a4
4
- data.tar.gz: 2a8dbc1907f3c2b48b9f24ee342d974686949ef3
3
+ metadata.gz: fcd82ad8c943b3b1555c4b4019b6945bea88b4fd
4
+ data.tar.gz: efe4918ea1f85cca3528dae2098c1bc108786638
5
5
  SHA512:
6
- metadata.gz: be86100e63189b39cbdb342ab8799e67f03a58b0b62f92fd165d4a70dcc3306da0639536cbc7cf8985dd63b699082a52d4f2021a13fa41f54658c0c1f9086b37
7
- data.tar.gz: 3b7f9ea1aec43791928f0afbd3fac58f91f7cd2d269dca02f3d5e2f7b80bda87de406090d2a8c90c71513aa2957da88a9ab99be33e71ad8efe5fd8330dadedb9
6
+ metadata.gz: aea1f3d343da09c7250f6b7e879e046ff05f1ac3be9a8f0afc4f18b15ccf49f296de0530e697a4a03cbbfad33085d55853fd19b2df397bf8a749cc12b8aea89d
7
+ data.tar.gz: 1cffa670f4d1c02ccc95ab5784653d22aaad3135f94b5ad9dd54123d6e515bbd34aeb826f3681b060e33bef39768caac6884449700cb8a68a3fd7c98ea203277
data/.codeclimate.yml ADDED
@@ -0,0 +1,40 @@
1
+ # This is a sample .codeclimate.yml configured for Engine analysis on Code
2
+ # Climate Platform. For an overview of the Code Climate Platform, see here:
3
+ # http://docs.codeclimate.com/article/300-the-codeclimate-platform
4
+
5
+ # Under the engines key, you can configure which engines will analyze your repo.
6
+ # Each key is an engine name. For each value, you need to specify enabled: true
7
+ # to enable the engine as well as any other engines-specific configuration.
8
+
9
+ # For more details, see here:
10
+ # http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml#platform
11
+
12
+ # For a list of all available engines, see here:
13
+ # http://docs.codeclimate.com/article/296-engines-available-engines
14
+ languages:
15
+ Ruby: true
16
+
17
+ engines:
18
+ # to turn on an engine, add it here and set enabled to `true`
19
+ # to turn off an engine, set enabled to `false` or remove it
20
+ rubocop:
21
+ enabled: true
22
+
23
+ # Engines can analyze files and report issues on them, but you can separately
24
+ # decide which files will receive ratings based on those issues. This is
25
+ # specified by path patterns under the ratings key.
26
+
27
+ # For more details see here:
28
+ # http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml#platform
29
+
30
+ ratings:
31
+ paths:
32
+ - lib/**
33
+
34
+ # You can globally exclude files from being analyzed by any engine using the
35
+ # exclude_paths key.
36
+
37
+ exclude_paths:
38
+ - examples/**/*
39
+ - test/**/*
40
+ - vendor/**/*
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  [![Code Climate](https://codeclimate.com/github/gavinlaking/vedeu.png)](https://codeclimate.com/github/gavinlaking/vedeu)
2
2
  [![Build Status](https://travis-ci.org/gavinlaking/vedeu.svg?branch=master)](https://travis-ci.org/gavinlaking/vedeu)
3
+ [![Test Coverage](https://codeclimate.com/github/gavinlaking/vedeu/badges/coverage.svg)](https://codeclimate.com/github/gavinlaking/vedeu/coverage)
3
4
 
4
5
  # Vedeu
5
6
 
data/docs/dsl.md CHANGED
@@ -75,48 +75,48 @@ end
75
75
 
76
76
  ## Borders
77
77
 
78
- {include:Vedeu::DSL::Border}
78
+ {include:Vedeu::Borders::DSL}
79
79
 
80
80
  ### Setting a title for the border
81
81
 
82
- {include:Vedeu::DSL::Border#title}
82
+ {include:Vedeu::Borders::DSL#title}
83
83
 
84
84
  ### Customising the appearance of the border
85
85
 
86
- {include:Vedeu::DSL::Border#bottom_left}
87
- {include:Vedeu::DSL::Border#bottom_right}
88
- {include:Vedeu::DSL::Border#horizontal}
89
- {include:Vedeu::DSL::Border#top_left}
90
- {include:Vedeu::DSL::Border#top_right}
91
- {include:Vedeu::DSL::Border#vertical}
86
+ {include:Vedeu::Borders::DSL#bottom_left}
87
+ {include:Vedeu::Borders::DSL#bottom_right}
88
+ {include:Vedeu::Borders::DSL#horizontal}
89
+ {include:Vedeu::Borders::DSL#top_left}
90
+ {include:Vedeu::Borders::DSL#top_right}
91
+ {include:Vedeu::Borders::DSL#vertical}
92
92
 
93
93
  ### Enabling/disabling the border
94
94
 
95
- {include:Vedeu::DSL::Border#enable!}
96
- {include:Vedeu::DSL::Border#disable!}
95
+ {include:Vedeu::Borders::DSL#enable!}
96
+ {include:Vedeu::Borders::DSL#disable!}
97
97
 
98
98
  ### Enabling/disabling an aspect of the border
99
99
 
100
- {include:Vedeu::DSL::Border#bottom}
101
- {include:Vedeu::DSL::Border#left}
102
- {include:Vedeu::DSL::Border#right}
103
- {include:Vedeu::DSL::Border#top}
100
+ {include:Vedeu::Borders::DSL#bottom}
101
+ {include:Vedeu::Borders::DSL#left}
102
+ {include:Vedeu::Borders::DSL#right}
103
+ {include:Vedeu::Borders::DSL#top}
104
104
 
105
105
  ## Geometry
106
106
 
107
- {include:Vedeu::DSL::Geometry}
107
+ {include:Vedeu::Geometry::DSL}
108
108
 
109
109
  ### Setting the interface dimensions
110
110
 
111
- {include:Vedeu::DSL::Geometry#centred}
112
- {include:Vedeu::DSL::Geometry#height}
113
- {include:Vedeu::DSL::Geometry#width}
114
- {include:Vedeu::DSL::Geometry#columns}
115
- {include:Vedeu::DSL::Geometry#rows}
116
- {include:Vedeu::DSL::Geometry#x}
117
- {include:Vedeu::DSL::Geometry#xn}
118
- {include:Vedeu::DSL::Geometry#y}
119
- {include:Vedeu::DSL::Geometry#yn}
111
+ {include:Vedeu::Geometry::DSL#centred}
112
+ {include:Vedeu::Geometry::DSL#height}
113
+ {include:Vedeu::Geometry::DSL#width}
114
+ {include:Vedeu::Geometry::DSL#columns}
115
+ {include:Vedeu::Geometry::DSL#rows}
116
+ {include:Vedeu::Geometry::DSL#x}
117
+ {include:Vedeu::Geometry::DSL#xn}
118
+ {include:Vedeu::Geometry::DSL#y}
119
+ {include:Vedeu::Geometry::DSL#yn}
120
120
 
121
121
  ## Groups
122
122
 
data/lib/vedeu/all.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  require 'vedeu/version'
2
+ require 'vedeu/options'
3
+
2
4
  require 'vedeu/runtime/launcher'
3
5
  require 'vedeu/runtime/bootstrap'
4
- require 'vedeu/exceptions'
6
+ require 'vedeu/error'
5
7
  require 'vedeu/log/lockless_log_device'
6
8
  require 'vedeu/log/mono_logger'
7
9
  require 'vedeu/log/log'
@@ -23,8 +25,6 @@ require 'vedeu/runtime/main_loop'
23
25
  require 'vedeu/runtime/flags'
24
26
  require 'vedeu/runtime/application'
25
27
 
26
- require 'vedeu/models/toggleable'
27
-
28
28
  require 'vedeu/repositories/collection'
29
29
  require 'vedeu/input/keys'
30
30
  require 'vedeu/repositories/repositories'
@@ -35,56 +35,22 @@ require 'vedeu/repositories/registerable'
35
35
  require 'vedeu/repositories/repository'
36
36
 
37
37
  require 'vedeu/null/null'
38
- require 'vedeu/null/border'
39
- require 'vedeu/null/buffer'
40
38
  require 'vedeu/null/generic'
41
- require 'vedeu/null/geometry'
42
39
  require 'vedeu/null/interface'
43
40
  require 'vedeu/null/menu'
44
41
  require 'vedeu/null/view'
45
42
 
46
- require 'vedeu/geometry/area'
47
- require 'vedeu/geometry/generic_coordinate'
48
- require 'vedeu/geometry/coordinate'
49
- require 'vedeu/geometry/dimension'
50
- require 'vedeu/geometry/geometry'
51
- require 'vedeu/geometry/geometries'
52
- require 'vedeu/geometry/grid'
53
- require 'vedeu/geometry/position'
54
-
55
- require 'vedeu/colours/all'
56
-
57
- require 'vedeu/buffers/buffer'
58
- require 'vedeu/buffers/buffers'
59
- require 'vedeu/buffers/virtual_buffer'
60
- require 'vedeu/buffers/virtual_buffers'
61
-
62
43
  require 'vedeu/refresh/refresh'
63
- require 'vedeu/refresh/refresh_cursor'
64
44
  require 'vedeu/refresh/refresh_buffer'
65
45
  require 'vedeu/refresh/refresh_group'
66
46
 
67
- require 'vedeu/cursor/cursor'
68
- require 'vedeu/cursor/cursors'
69
- require 'vedeu/cursor/move'
70
- require 'vedeu/cursor/reposition'
47
+ require 'vedeu/models/toggleable'
71
48
 
72
49
  require 'vedeu/esc/actions'
73
50
  require 'vedeu/esc/borders'
74
51
  require 'vedeu/esc/colours'
75
52
  require 'vedeu/esc/esc'
76
53
 
77
- require 'vedeu/output/renderers/renderer_options'
78
- require 'vedeu/output/renderers/escape_sequence'
79
- require 'vedeu/output/renderers/file'
80
- require 'vedeu/output/renderers/html'
81
- require 'vedeu/output/renderers/json'
82
- require 'vedeu/output/renderers/null'
83
- require 'vedeu/output/renderers/terminal'
84
- require 'vedeu/output/renderers/text'
85
- require 'vedeu/output/renderers'
86
-
87
- require 'vedeu/events/all'
88
54
  require 'vedeu/models/views/all'
89
55
 
90
56
  require 'vedeu/models/cell'
@@ -94,6 +60,8 @@ require 'vedeu/models/group'
94
60
  require 'vedeu/models/groups'
95
61
  require 'vedeu/models/menu'
96
62
  require 'vedeu/models/menus'
63
+ require 'vedeu/models/row'
64
+ require 'vedeu/models/page'
97
65
 
98
66
  require 'vedeu/templating/all'
99
67
  require 'vedeu/templating/encoder'
@@ -119,9 +87,7 @@ require 'vedeu/dsl/dsl'
119
87
  require 'vedeu/dsl/shared'
120
88
  require 'vedeu/dsl/use'
121
89
  require 'vedeu/dsl/presentation'
122
- require 'vedeu/dsl/border'
123
90
  require 'vedeu/dsl/composition'
124
- require 'vedeu/dsl/geometry'
125
91
  require 'vedeu/dsl/group'
126
92
  require 'vedeu/dsl/keymap'
127
93
  require 'vedeu/dsl/text'
@@ -139,9 +105,12 @@ require 'vedeu/input/keymap'
139
105
  require 'vedeu/input/keymaps'
140
106
  require 'vedeu/input/editor/all'
141
107
 
142
- require 'vedeu/borders/render_border'
143
- require 'vedeu/borders/border'
144
- require 'vedeu/borders/borders'
108
+ require 'vedeu/borders/all'
109
+ require 'vedeu/buffers/all'
110
+ require 'vedeu/colours/all'
111
+ require 'vedeu/cursors/all'
112
+ require 'vedeu/events/all'
113
+ require 'vedeu/geometry/all'
145
114
 
146
115
  require 'vedeu/output/direct'
147
116
  require 'vedeu/output/clear/named_group'
@@ -151,10 +120,18 @@ require 'vedeu/output/compressor'
151
120
  require 'vedeu/output/style'
152
121
  require 'vedeu/output/text'
153
122
  require 'vedeu/output/html_char'
154
-
155
123
  require 'vedeu/output/output'
156
124
  require 'vedeu/output/viewport'
157
125
  require 'vedeu/output/wordwrap'
126
+ require 'vedeu/output/renderers/renderer_options'
127
+ require 'vedeu/output/renderers/escape_sequence'
128
+ require 'vedeu/output/renderers/file'
129
+ require 'vedeu/output/renderers/html'
130
+ require 'vedeu/output/renderers/json'
131
+ require 'vedeu/output/renderers/null'
132
+ require 'vedeu/output/renderers/terminal'
133
+ require 'vedeu/output/renderers/text'
134
+ require 'vedeu/output/renderers'
158
135
 
159
136
  require 'vedeu/api'
160
137
  require 'vedeu/internal_api'
data/lib/vedeu/api.rb CHANGED
@@ -34,8 +34,8 @@ module Vedeu
34
34
  # Vedeu.cursor
35
35
  #
36
36
  # @!method cursor
37
- # @return [Vedeu::Cursor]
38
- def_delegators Vedeu::Cursors, :cursor
37
+ # @return [Vedeu::Cursors::Cursor]
38
+ def_delegators Vedeu::Cursors::Repository, :cursor
39
39
 
40
40
  # Manipulate the DRb server implementation.
41
41
  #
@@ -60,15 +60,15 @@ module Vedeu
60
60
  # Vedeu.border
61
61
  #
62
62
  # @!method border
63
- # @see Vedeu::DSL::Border.border
64
- def_delegators Vedeu::DSL::Border, :border
63
+ # @see Vedeu::Borders::DSL.border
64
+ def_delegators Vedeu::Borders::DSL, :border
65
65
 
66
66
  # @example
67
67
  # Vedeu.geometry
68
68
  #
69
69
  # @!method geometry
70
- # @see Vedeu::DSL::Geometry.geometry
71
- def_delegators Vedeu::DSL::Geometry, :geometry
70
+ # @see Vedeu::Geometry::DSL.geometry
71
+ def_delegators Vedeu::Geometry::DSL, :geometry
72
72
 
73
73
  # @example
74
74
  # Vedeu.group
@@ -250,8 +250,8 @@ module Vedeu
250
250
  # Vedeu.hide_cursor(name)
251
251
  #
252
252
  # @!method hide_cursor
253
- # @see Vedeu::Cursor#hide
254
- def_delegators Vedeu::Cursor, :hide_cursor
253
+ # @see Vedeu::Cursors::Cursor#hide
254
+ def_delegators Vedeu::Cursors::Cursor, :hide_cursor
255
255
 
256
256
  # Shows the cursor for the interface of the given name.
257
257
  #
@@ -259,8 +259,8 @@ module Vedeu
259
259
  # Vedeu.show_cursor(name)
260
260
  #
261
261
  # @!method show_cursor
262
- # @see Vedeu::Cursor#show
263
- def_delegators Vedeu::Cursor, :show_cursor
262
+ # @see Vedeu::Cursors::Cursor#show
263
+ def_delegators Vedeu::Cursors::Cursor, :show_cursor
264
264
 
265
265
  # Toggle the visibility of the cursor with the given name.
266
266
  #
@@ -268,9 +268,9 @@ module Vedeu
268
268
  # Vedeu.toggle_cursor(name)
269
269
  #
270
270
  # @!method toggle_cursor
271
- # @see Vedeu::Cursor#hide
272
- # @see Vedeu::Cursor#show
273
- def_delegators Vedeu::Cursor, :toggle_cursor
271
+ # @see Vedeu::Cursors::Cursor#hide
272
+ # @see Vedeu::Cursors::Cursor#show
273
+ def_delegators Vedeu::Cursors::Cursor, :toggle_cursor
274
274
 
275
275
  # @!method hide_group
276
276
  # @see Vedeu::Group#hide
@@ -8,6 +8,8 @@ module Vedeu
8
8
 
9
9
  include Vedeu::Controller
10
10
 
11
+ # Returns an instance of Vedeu::ApplicationController.
12
+ #
11
13
  # @param params [Hash] The named parameters provided to the controller which
12
14
  # will be used by the actions within the controller.
13
15
  # @return [Vedeu::ApplicationController]
@@ -21,32 +21,63 @@ module Vedeu
21
21
 
22
22
  private
23
23
 
24
- # Move the cursor/view down, left, right or up by one character.
24
+ # Adjusts the position of the cursor or view.
25
25
  #
26
26
  # @example
27
- # Vedeu.trigger(:_cursor_down_, name)
28
- # Vedeu.trigger(:_view_down_, name)
29
- # Vedeu.trigger(:_geometry_down_, name)
30
- # Vedeu.trigger(:_cursor_left_, name)
31
- # Vedeu.trigger(:_view_left_, name)
32
- # Vedeu.trigger(:_geometry_left_, name)
33
- # Vedeu.trigger(:_cursor_right_, name)
34
- # Vedeu.trigger(:_view_right_, name)
35
- # Vedeu.trigger(:_geometry_right_, name)
36
- # Vedeu.trigger(:_cursor_up_, name)
37
- # Vedeu.trigger(:_view_up_, name)
38
- # Vedeu.trigger(:_geometry_up_, name)
27
+ # Vedeu.trigger(:_cursor_down_)
28
+ #
29
+ # Vedeu.trigger(:_cursor_left_) # When a name is not given, the cursor
30
+ # # in the interface which is currently in
31
+ # # focus should move to the left.
32
+ #
33
+ # Vedeu.trigger(:_cursor_left_, 'my_interface')
34
+ # # When a name is given, the cursor
35
+ # # instance belonging to this interface
36
+ # # moves to the left.
37
+ #
38
+ # Vedeu.trigger(:_cursor_right_)
39
+ # Vedeu.trigger(:_cursor_up_)
40
+ #
41
+ # Vedeu.trigger(:_cursor_origin_) # /or/
42
+ # Vedeu.trigger(:_cursor_origin_, 'my_interface')
43
+ # # Moves the cursor to the top left of
44
+ # # the named or current interface in
45
+ # # focus.
46
+ #
47
+ # Vedeu.trigger(:_view_down_, 'my_interface')
48
+ # Vedeu.trigger(:_view_left_, 'my_interface')
49
+ # Vedeu.trigger(:_view_right_, 'my_interface')
50
+ # Vedeu.trigger(:_view_up_, 'my_interface')
51
+ #
52
+ # Each of the :_view_* events has an alias, :_geometry_*
53
+ #
54
+ # @note
55
+ # The cursor or view may not be visible, but it will still move if
56
+ # requested.
57
+ # The cursor will not exceed the border or boundary of the interface, or
58
+ # boundary of the visible terminal.
59
+ # The cursor will move freely within the bounds of the interface,
60
+ # irrespective of content.
61
+ # The view will not exceed the boundary of the visible terminal.
62
+ # The view will move freely within the bounds of the interface,
63
+ # irrespective of content.
39
64
  #
40
65
  # @return [TrueClass]
41
- # @see Vedeu::Move
42
66
  def directional!
43
67
  [:down, :left, :right, :up].each do |direction|
44
68
  Vedeu.bind("_cursor_#{direction}_".to_sym) do |name|
45
- Vedeu::Move.send(direction, Vedeu::Cursor, name)
69
+ Vedeu.cursors.by_name(name).send("move_#{direction}")
70
+
71
+ Vedeu.trigger(:_refresh_cursor_, name)
46
72
  end
47
73
 
48
74
  Vedeu.bind("_view_#{direction}_".to_sym) do |name|
49
- Vedeu::Move.send(direction, Vedeu::Geometry, name)
75
+ Vedeu.geometries.by_name(name).send("move_#{direction}")
76
+
77
+ Vedeu.trigger(:_clear_)
78
+ Vedeu.trigger(:_refresh_)
79
+ Vedeu.trigger(:_clear_, name)
80
+ Vedeu.trigger(:_refresh_, name)
50
81
  end
51
82
 
52
83
  Vedeu.bind_alias("_geometry_#{direction}_".to_sym,
@@ -65,7 +96,7 @@ module Vedeu
65
96
  # @see Vedeu::Move
66
97
  def cursor_origin!
67
98
  Vedeu.bind(:_cursor_origin_) do |name|
68
- Vedeu::Move.origin(Vedeu::Cursor, name)
99
+ Vedeu::Move.origin(Vedeu::Cursors::Cursor, name)
69
100
  end
70
101
 
71
102
  Vedeu.bind_alias(:_cursor_reset_, :_cursor_origin_)
@@ -95,7 +126,11 @@ module Vedeu
95
126
  # @see Vedeu::Move
96
127
  def cursor_reposition!
97
128
  Vedeu.bind(:_cursor_reposition_) do |name, y, x|
98
- Vedeu::Reposition.to(Vedeu::Cursor, name, y, x)
129
+ Vedeu.cursors.by_name(name).reposition(y, x)
130
+
131
+ Vedeu.trigger(:_clear_, name)
132
+ Vedeu.trigger(:_refresh_, name)
133
+ Vedeu.trigger(:_refresh_cursor_, name)
99
134
  end
100
135
  end
101
136
 
@@ -49,7 +49,7 @@ module Vedeu
49
49
  # @return [TrueClass]
50
50
  def refresh_cursor!
51
51
  Vedeu.bind(:_refresh_cursor_) do |name|
52
- Vedeu::RefreshCursor.by_name(name)
52
+ Vedeu::Cursors::Refresh.by_name(name)
53
53
  end
54
54
  end
55
55