vedeu 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +9 -0
  3. data/README.md +1 -1
  4. data/docs/api.md +60 -67
  5. data/docs/configuration.md +8 -5
  6. data/docs/events.md +31 -15
  7. data/docs/events/application.md +12 -0
  8. data/docs/events/document.md +57 -0
  9. data/docs/events/drb.md +43 -0
  10. data/docs/events/focus.md +24 -0
  11. data/docs/events/menu.md +57 -0
  12. data/docs/events/movement.md +57 -0
  13. data/docs/events/refresh.md +25 -0
  14. data/docs/events/system.md +90 -0
  15. data/docs/events/visibility.md +68 -0
  16. data/lib/vedeu.rb +2 -2
  17. data/lib/vedeu/all.rb +3 -2
  18. data/lib/vedeu/api.rb +18 -18
  19. data/lib/vedeu/application/controller.rb +1 -1
  20. data/lib/vedeu/application/helper.rb +1 -1
  21. data/lib/vedeu/application/view.rb +1 -1
  22. data/lib/vedeu/bindings/application.rb +1 -12
  23. data/lib/vedeu/bindings/bindings.rb +3 -1
  24. data/lib/vedeu/bindings/document.rb +9 -62
  25. data/lib/vedeu/bindings/drb.rb +12 -56
  26. data/lib/vedeu/bindings/focus.rb +3 -28
  27. data/lib/vedeu/bindings/menus.rb +10 -66
  28. data/lib/vedeu/bindings/movement.rb +4 -69
  29. data/lib/vedeu/bindings/refresh.rb +3 -33
  30. data/lib/vedeu/bindings/system.rb +14 -100
  31. data/lib/vedeu/bindings/visibility.rb +20 -71
  32. data/lib/vedeu/borders/all.rb +4 -3
  33. data/lib/vedeu/borders/border.rb +39 -33
  34. data/lib/vedeu/borders/dsl.rb +40 -33
  35. data/lib/vedeu/borders/null.rb +2 -2
  36. data/lib/vedeu/borders/render.rb +29 -24
  37. data/lib/vedeu/borders/repository.rb +2 -2
  38. data/lib/vedeu/buffers/all.rb +8 -7
  39. data/lib/vedeu/buffers/buffer.rb +47 -39
  40. data/lib/vedeu/buffers/null.rb +2 -2
  41. data/lib/vedeu/buffers/refresh.rb +4 -3
  42. data/lib/vedeu/buffers/virtual_buffer.rb +122 -118
  43. data/lib/vedeu/buffers/virtual_buffers.rb +62 -56
  44. data/lib/vedeu/colours/background.rb +2 -1
  45. data/lib/vedeu/colours/colour.rb +21 -19
  46. data/lib/vedeu/colours/foreground.rb +2 -1
  47. data/lib/vedeu/colours/repository.rb +6 -5
  48. data/lib/vedeu/colours/translator.rb +39 -35
  49. data/lib/vedeu/configuration/api.rb +59 -51
  50. data/lib/vedeu/configuration/cli.rb +9 -7
  51. data/lib/vedeu/configuration/configuration.rb +41 -32
  52. data/lib/vedeu/cursors/cursor.rb +1 -1
  53. data/lib/vedeu/cursors/refresh.rb +20 -16
  54. data/lib/vedeu/distributed/server.rb +8 -6
  55. data/lib/vedeu/distributed/subprocess.rb +90 -86
  56. data/lib/vedeu/distributed/uri.rb +4 -3
  57. data/lib/vedeu/dsl/composition.rb +2 -2
  58. data/lib/vedeu/dsl/group.rb +4 -4
  59. data/lib/vedeu/dsl/interface.rb +5 -5
  60. data/lib/vedeu/dsl/presentation.rb +2 -2
  61. data/lib/vedeu/dsl/text.rb +1 -1
  62. data/lib/vedeu/editor/cropper.rb +4 -4
  63. data/lib/vedeu/editor/cursor.rb +6 -4
  64. data/lib/vedeu/editor/document.rb +20 -18
  65. data/lib/vedeu/editor/editor.rb +2 -2
  66. data/lib/vedeu/editor/line.rb +10 -5
  67. data/lib/vedeu/editor/lines.rb +2 -2
  68. data/lib/vedeu/internal_api.rb +4 -4
  69. data/lib/vedeu/models/focus.rb +197 -191
  70. data/lib/vedeu/models/group.rb +171 -159
  71. data/lib/vedeu/models/groups.rb +14 -10
  72. data/lib/vedeu/models/interface.rb +116 -110
  73. data/lib/vedeu/models/interfaces.rb +24 -20
  74. data/lib/vedeu/models/toggleable.rb +4 -4
  75. data/lib/vedeu/models/views/char.rb +1 -1
  76. data/lib/vedeu/models/views/composition.rb +1 -1
  77. data/lib/vedeu/models/views/line.rb +1 -1
  78. data/lib/vedeu/models/views/stream.rb +1 -1
  79. data/lib/vedeu/models/views/view.rb +1 -1
  80. data/lib/vedeu/null/interface.rb +1 -1
  81. data/lib/vedeu/null/view.rb +1 -1
  82. data/lib/vedeu/output/clear/named_interface.rb +1 -1
  83. data/lib/vedeu/output/compressor.rb +78 -73
  84. data/lib/vedeu/output/direct.rb +61 -57
  85. data/lib/vedeu/output/output.rb +34 -29
  86. data/lib/vedeu/output/{presentation.rb → presentation/presentation.rb} +2 -1
  87. data/lib/vedeu/output/presentation/style.rb +64 -18
  88. data/lib/vedeu/output/presentation/styles.rb +39 -0
  89. data/lib/vedeu/output/renderers/html.rb +2 -2
  90. data/lib/vedeu/output/renderers/json.rb +2 -1
  91. data/lib/vedeu/output/renderers/terminal.rb +3 -3
  92. data/lib/vedeu/output/renderers/text.rb +3 -3
  93. data/lib/vedeu/output/text.rb +186 -180
  94. data/lib/vedeu/output/wordwrap.rb +142 -138
  95. data/lib/vedeu/refresh/refresh.rb +2 -2
  96. data/lib/vedeu/templating/helpers.rb +11 -6
  97. data/lib/vedeu/templating/view_template.rb +1 -1
  98. data/lib/vedeu/terminal/terminal.rb +2 -2
  99. data/lib/vedeu/version.rb +1 -1
  100. data/test/lib/vedeu/borders/render_test.rb +1 -1
  101. data/test/lib/vedeu/buffers/buffer_test.rb +16 -14
  102. data/test/lib/vedeu/buffers/virtual_buffer_test.rb +105 -101
  103. data/test/lib/vedeu/buffers/virtual_buffers_test.rb +43 -39
  104. data/test/lib/vedeu/colours/colour_test.rb +4 -4
  105. data/test/lib/vedeu/cursors/cursor_test.rb +2 -2
  106. data/test/lib/vedeu/cursors/repository_test.rb +3 -3
  107. data/test/lib/vedeu/distributed/subprocess_test.rb +33 -29
  108. data/test/lib/vedeu/dsl/group_test.rb +3 -3
  109. data/test/lib/vedeu/dsl/interface_test.rb +6 -5
  110. data/test/lib/vedeu/dsl/line_test.rb +4 -2
  111. data/test/lib/vedeu/dsl/presentation_test.rb +2 -2
  112. data/test/lib/vedeu/dsl/text_test.rb +8 -8
  113. data/test/lib/vedeu/editor/document_test.rb +10 -6
  114. data/test/lib/vedeu/input/keymap_test.rb +1 -10
  115. data/test/lib/vedeu/models/focus_test.rb +177 -170
  116. data/test/lib/vedeu/models/group_test.rb +99 -95
  117. data/test/lib/vedeu/models/groups_test.rb +13 -9
  118. data/test/lib/vedeu/models/interface_test.rb +93 -87
  119. data/test/lib/vedeu/models/interfaces_test.rb +24 -20
  120. data/test/lib/vedeu/models/views/char_test.rb +2 -2
  121. data/test/lib/vedeu/models/views/line_test.rb +11 -7
  122. data/test/lib/vedeu/models/views/stream_test.rb +1 -1
  123. data/test/lib/vedeu/models/views/view_test.rb +1 -1
  124. data/test/lib/vedeu/output/clear/named_group_test.rb +1 -1
  125. data/test/lib/vedeu/output/clear/named_interface_test.rb +3 -1
  126. data/test/lib/vedeu/output/compressor_test.rb +126 -122
  127. data/test/lib/vedeu/output/direct_test.rb +49 -43
  128. data/test/lib/vedeu/output/output_test.rb +35 -31
  129. data/test/lib/vedeu/output/{presentation_test.rb → presentation/presentation_test.rb} +11 -7
  130. data/test/lib/vedeu/output/presentation/style_test.rb +88 -48
  131. data/test/lib/vedeu/output/presentation/styles_test.rb +84 -0
  132. data/test/lib/vedeu/output/text_test.rb +109 -105
  133. data/test/lib/vedeu/output/viewport_test.rb +3 -1
  134. data/test/lib/vedeu/output/wordwrap_test.rb +209 -205
  135. data/test/lib/vedeu/refresh/refresh_test.rb +3 -1
  136. data/test/lib/vedeu/templating/helpers_test.rb +6 -6
  137. data/test/lib/vedeu/templating/view_template_test.rb +1 -1
  138. metadata +17 -8
  139. data/lib/vedeu/output/style.rb +0 -76
  140. data/test/lib/vedeu/output/style_test.rb +0 -120
@@ -0,0 +1,57 @@
1
+ # @title Vedeu Movement Events
2
+
3
+ ## Movement Events
4
+
5
+ ### :_cursor_origin_
6
+ This event moves the cursor to the interface origin; the top left
7
+ corner of the named interface.
8
+
9
+ Vedeu.trigger(:_cursor_origin_, name)
10
+ Vedeu.trigger(:_cursor_reset_, name)
11
+
12
+ ### :_cursor_position_
13
+ When triggered will return the current position of the cursor.
14
+
15
+ Vedeu.trigger(:_cursor_position_, name)
16
+
17
+ ### :_cursor_reposition_
18
+ Moves the cursor to a relative position inside the interface.
19
+
20
+ Vedeu.trigger(:_cursor_reposition_, name, y, x)
21
+
22
+ ### :_cursor_(up, down, left, right)_
23
+ Adjusts the position of the cursor or view.
24
+
25
+ When a name is not given, the cursor in the interface which is
26
+ currently in focus should move in the direction specified.
27
+
28
+ Vedeu.trigger(:_cursor_left_, 'my_interface')
29
+ Vedeu.trigger(:_cursor_left_)
30
+ Vedeu.trigger(:_cursor_right_)
31
+ Vedeu.trigger(:_cursor_up_)
32
+ Vedeu.trigger(:_cursor_down_)
33
+
34
+ - The cursor or view may not be visible, but it will still move if
35
+ requested.
36
+ - The cursor will not exceed the border or boundary of the interface,
37
+ or boundary of the visible terminal.
38
+ - The cursor will move freely within the bounds of the interface,
39
+ irrespective of content.
40
+ - The view will not exceed the boundary of the visible terminal,
41
+ though its offset may (this means content will appear to have
42
+ scrolled).
43
+ - The view will move freely within the bounds of the interface,
44
+ irrespective of content.
45
+
46
+ ### :_view_(up, down, left, right)_
47
+
48
+ See {file:docs/events.md#\_cursor__up_down_left_right_}
49
+
50
+ Please note that the name of the view is required for these events.
51
+
52
+ Vedeu.trigger(:_view_down_, 'my_interface')
53
+ Vedeu.trigger(:_view_left_, 'my_interface')
54
+ Vedeu.trigger(:_view_right_, 'my_interface')
55
+ Vedeu.trigger(:_view_up_, 'my_interface')
56
+
57
+ Each of the :_view_* events has an alias, :_geometry_* if you prefer.
@@ -0,0 +1,25 @@
1
+ # @title Vedeu Refresh Events
2
+
3
+ ## Refresh Events
4
+
5
+ ### :_refresh_
6
+ Refreshes all registered interfaces or the named interface.
7
+
8
+ The interfaces will be refreshed in z-index order, meaning that
9
+ interfaces with a lower z-index will be drawn first. This means
10
+ overlapping interfaces will be drawn as specified. Hidden interfaces
11
+ will be still refreshed in memory but not shown.
12
+
13
+ Vedeu.trigger(:_refresh_)
14
+ Vedeu.trigger(:_refresh_, name)
15
+
16
+ ### :_refresh_cursor_
17
+ Will cause the named cursor to refresh, or the cursor of the interface
18
+ which is currently in focus.
19
+
20
+ Vedeu.trigger(:_refresh_cursor_, name)
21
+
22
+ ### :_refresh_group_
23
+ Will cause all interfaces in the named group to refresh.
24
+
25
+ Vedeu.trigger(:_refresh_group_, name)
@@ -0,0 +1,90 @@
1
+ # @title Vedeu System Events
2
+
3
+ ## System Events
4
+
5
+ ### :_cleanup_
6
+ Vedeu triggers this event when `:_exit_` is triggered. You can hook
7
+ into this to perform a special action before the application
8
+ terminates. Saving the user's work, session or preferences might be
9
+ popular here.
10
+
11
+ Vedeu.trigger(:_exit_)
12
+
13
+ ### :_clear_
14
+ Clears the whole terminal space, or when a name is given, the named
15
+ interface area will be cleared.
16
+
17
+ Vedeu.trigger(:_clear_)
18
+ Vedeu.clear_by_name(name)
19
+
20
+ ### :_command_
21
+ Will cause the triggering of the `:command` event; which you should
22
+ define to 'do things'.
23
+
24
+ Vedeu.trigger(:_command_, command)
25
+
26
+ ### :_editor_
27
+ This event is called by {Vedeu::Input::Input#capture}. When
28
+ invoked, the key will be passed to the editor for currently
29
+ focussed view.
30
+
31
+ Vedeu.trigger(:_editor_, key)
32
+
33
+ ### :_exit_
34
+ When triggered, Vedeu will trigger a `:cleanup` event which you can
35
+ define (to save files, etc) and attempt to exit.
36
+
37
+ Vedeu.trigger(:_exit_)
38
+ Vedeu.exit
39
+
40
+ ### :_initialize_
41
+ Vedeu triggers this event when it is ready to enter the main loop.
42
+ Client applications can listen for this event and perform some
43
+ action(s), like render the first screen, interface or make a sound.
44
+
45
+ Vedeu.trigger(:_initialize_)
46
+
47
+ ### :_keypress_
48
+ Will cause the triggering of the `:key` event; which you should define
49
+ to 'do things'. If the `escape` key is pressed, then `key` is triggered
50
+ with the argument `:escape`, also an internal event `_mode_switch_` is
51
+ triggered. Vedeu recognises most key presses and some 'extended'
52
+ keypress (eg. Ctrl+J), a list of supported keypresses can be found here:
53
+ {Vedeu::Input::Input#specials} and {Vedeu::Input::Input#f_keys}.
54
+
55
+ Vedeu.trigger(:_keypress_, key)
56
+
57
+ ### :_log_
58
+ When triggered with a message will cause Vedeu to log the message if
59
+ logging is enabled in the configuration.
60
+
61
+ Vedeu.trigger(:_log_, message)
62
+
63
+ ### :_maximise_
64
+ Maximising an interface.
65
+
66
+ Vedeu.trigger(:_maximise_, name)
67
+
68
+ See {Vedeu::Geometry::Geometry#maximise}
69
+
70
+ ### :_mode_switch_
71
+ When triggered (by default, after the user presses `escape`), Vedeu
72
+ switches between modes of the terminal. The idea here being
73
+ that the raw mode is for single keypress actions, whilst fake and cooked
74
+ modes allow the user to enter more elaborate commands- such as commands
75
+ with arguments.
76
+
77
+ Vedeu.trigger(:_mode_switch_)
78
+
79
+ ### :_resize_
80
+ When triggered will cause Vedeu to trigger the `:_clear_` and
81
+ `:_refresh_` events. Please see those events for their behaviour.
82
+
83
+ Vedeu.trigger(:_resize_)
84
+
85
+ ### :_unmaximise_
86
+ Unmaximising an interface.
87
+
88
+ Vedeu.trigger(:_unmaximise_, name)
89
+
90
+ See {Vedeu::Geometry::Geometry#unmaximise}
@@ -0,0 +1,68 @@
1
+ # @title Vedeu Visibility Events
2
+
3
+ ## Visibility Events
4
+
5
+ ### :_clear_group_
6
+ Clears the spaces occupied by the interfaces belonging to the named
7
+ group.
8
+
9
+ Vedeu.trigger(:_clear_group_, name)
10
+ Vedeu.clear_by_group(name)
11
+
12
+ ### :_hide_cursor_
13
+ Hide the cursor of the named interface or when a name is not given,
14
+ the interface currently in focus.
15
+
16
+ Vedeu.trigger(:_hide_cursor_, name)
17
+ Vedeu.trigger(:_cursor_hide_, name)
18
+ Vedeu.hide_cursor(name)
19
+
20
+ ### :_hide_group_
21
+ Hiding a group of interfaces.
22
+
23
+ Vedeu.trigger(:_hide_group_, name)
24
+ Vedeu.hide_group(name)
25
+
26
+ ### :_hide_interface_
27
+ Hiding an interface.
28
+
29
+ Vedeu.trigger(:_hide_interface_, name)
30
+ Vedeu.hide_interface(name)
31
+
32
+ ### :_show_cursor_
33
+ Show the cursor of the named interface or when a name is not given,
34
+ the interface currently in focus.
35
+
36
+ Vedeu.trigger(:_show_cursor_, name)
37
+ Vedeu.trigger(:_cursor_show_, name)
38
+ Vedeu.show_cursor(name)
39
+
40
+ ### :_show_group_
41
+ Showing a group of interfaces.
42
+
43
+ Vedeu.trigger(:_show_group_, name)
44
+ Vedeu.show_group(name)
45
+
46
+ ### :_show_interface_
47
+ Showing an interface.
48
+
49
+ Vedeu.trigger(:_show_interface_, name)
50
+ Vedeu.show_interface(name)
51
+
52
+ ### :_toggle_cursor_
53
+ Toggling a cursor.
54
+
55
+ Vedeu.trigger(:_toggle_cursor_, name)
56
+ Vedeu.toggle_cursor(name)
57
+
58
+ ### :_toggle_group_
59
+ Toggling a group of interfaces.
60
+
61
+ Vedeu.trigger(:_toggle_group_, name)
62
+ Vedeu.toggle_group(name)
63
+
64
+ ### :_toggle_interface_
65
+ Toggling an interface.
66
+
67
+ Vedeu.trigger(:_toggle_interface_, name)
68
+ Vedeu.toggle_interface(name)
data/lib/vedeu.rb CHANGED
@@ -34,9 +34,9 @@ module Vedeu
34
34
 
35
35
  # Return the name of currently focussed interface.
36
36
  #
37
- # @return [Vedeu::Focus]
37
+ # @return [Vedeu::Models::Focus]
38
38
  def self.focusable
39
- @focusable ||= Vedeu::Focus
39
+ @focusable ||= Vedeu::Models::Focus
40
40
  end
41
41
 
42
42
  # :nocov:
data/lib/vedeu/all.rb CHANGED
@@ -100,12 +100,13 @@ require 'vedeu/geometry/all'
100
100
  require 'vedeu/input/all'
101
101
  require 'vedeu/menus/all'
102
102
 
103
+ require 'vedeu/output/presentation/presentation'
104
+
103
105
  require 'vedeu/output/direct'
104
106
  require 'vedeu/output/clear/named_group'
105
107
  require 'vedeu/output/clear/named_interface'
106
- require 'vedeu/output/presentation'
108
+
107
109
  require 'vedeu/output/compressor'
108
- require 'vedeu/output/style'
109
110
  require 'vedeu/output/text'
110
111
  require 'vedeu/output/output'
111
112
  require 'vedeu/output/viewport'
data/lib/vedeu/api.rb CHANGED
@@ -87,16 +87,16 @@ module Vedeu
87
87
  def_delegators Vedeu::Events::Aliases, :bind_alias, :unbind_alias
88
88
 
89
89
  # @!method focus
90
- # @see Vedeu::Focus#focus
90
+ # @see Vedeu::Models::Focus#focus
91
91
  # @!method focus_by_name
92
- # @see Vedeu::Focus#focus_by_name
92
+ # @see Vedeu::Models::Focus#focus_by_name
93
93
  # @!method focussed?
94
- # @see Vedeu::Focus#focussed?
94
+ # @see Vedeu::Models::Focus#focussed?
95
95
  # @!method focus_next
96
- # @see Vedeu::Focus#focus_next
96
+ # @see Vedeu::Models::Focus#focus_next
97
97
  # @!method focus_previous
98
- # @see Vedeu::Focus#focus_previous
99
- def_delegators Vedeu::Focus, :focus, :focus_by_name, :focussed?,
98
+ # @see Vedeu::Models::Focus#focus_previous
99
+ def_delegators Vedeu::Models::Focus, :focus, :focus_by_name, :focussed?,
100
100
  :focus_next, :focus_previous
101
101
 
102
102
  # @!method log
@@ -160,28 +160,28 @@ module Vedeu
160
160
  def_delegators Vedeu::Cursors::Cursor, :toggle_cursor
161
161
 
162
162
  # @!method hide_group
163
- # @see Vedeu::Group#hide
164
- def_delegators Vedeu::Group, :hide_group
163
+ # @see Vedeu::Models::Group#hide
164
+ def_delegators Vedeu::Models::Group, :hide_group
165
165
 
166
166
  # @!method show_group
167
- # @see Vedeu::Group#show
168
- def_delegators Vedeu::Group, :show_group
167
+ # @see Vedeu::Models::Group#show
168
+ def_delegators Vedeu::Models::Group, :show_group
169
169
 
170
170
  # @!method toggle_group
171
- # @see Vedeu::Group#toggle
172
- def_delegators Vedeu::Group, :toggle_group
171
+ # @see Vedeu::Models::Group#toggle
172
+ def_delegators Vedeu::Models::Group, :toggle_group
173
173
 
174
174
  # @!method hide_interface
175
- # @see Vedeu::Interface#hide
176
- def_delegators Vedeu::Interface, :hide_interface
175
+ # @see Vedeu::Models::Interface#hide
176
+ def_delegators Vedeu::Models::Interface, :hide_interface
177
177
 
178
178
  # @!method show_interface
179
- # @see Vedeu::Interface#show
180
- def_delegators Vedeu::Interface, :show_interface
179
+ # @see Vedeu::Models::Interface#show
180
+ def_delegators Vedeu::Models::Interface, :show_interface
181
181
 
182
182
  # @!method toggle_interface
183
- # @see Vedeu::Interface#toggle
184
- def_delegators Vedeu::Interface, :toggle_interface
183
+ # @see Vedeu::Models::Interface#toggle
184
+ def_delegators Vedeu::Models::Interface, :toggle_interface
185
185
 
186
186
  end # API
187
187
 
@@ -1,6 +1,6 @@
1
1
  module Vedeu
2
2
 
3
- # Provides methods to be used by Vedeu::ApplicationController.
3
+ # Provides methods to be used by {Vedeu::ApplicationController}.
4
4
  #
5
5
  module Controller
6
6
 
@@ -1,6 +1,6 @@
1
1
  module Vedeu
2
2
 
3
- # Provides methods to be used by Vedeu::ApplicationHelper.
3
+ # Provides methods to be used by {Vedeu::ApplicationHelper}.
4
4
  #
5
5
  module Helper
6
6
 
@@ -1,6 +1,6 @@
1
1
  module Vedeu
2
2
 
3
- # Provides methods to be used by Vedeu::ApplicationView.
3
+ # Provides methods to be used by {Vedeu::ApplicationView}.
4
4
  #
5
5
  module View
6
6
 
@@ -4,7 +4,6 @@ module Vedeu
4
4
 
5
5
  # System events relating to movement of cursors or interfaces.
6
6
  #
7
- # :nocov:
8
7
  module Application
9
8
 
10
9
  extend self
@@ -19,16 +18,7 @@ module Vedeu
19
18
 
20
19
  private
21
20
 
22
- # Call a client application controller's action with parameters.
23
- #
24
- # @example
25
- # Vedeu.trigger(:_goto_,
26
- # :your_controller,
27
- # :some_action,
28
- # { id: 7 })
29
- # Vedeu.goto(:your_controller, :some_action, { id: 7 })
30
- #
31
- # @return [TrueClass]
21
+ # See {file:docs/events/application.md#\_goto_}
32
22
  def goto!
33
23
  Vedeu.bind(:_goto_) do |controller, action, **args|
34
24
  Vedeu::Router.goto(controller, action, **args)
@@ -38,7 +28,6 @@ module Vedeu
38
28
  end
39
29
 
40
30
  end # Application
41
- # :nocov:
42
31
 
43
32
  end # Bindings
44
33
 
@@ -1,6 +1,8 @@
1
1
  module Vedeu
2
2
 
3
- # Binds various events for running and manipulating Vedeu.
3
+ # Binds various events for running and manipulating Vedeu. When
4
+ # called provide a variety of core functions and behaviours.
5
+ # They are soft-namespaced using underscores.
4
6
  #
5
7
  # @note
6
8
  # The methods these modules use are private, and should not be
@@ -5,7 +5,6 @@ module Vedeu
5
5
  # System events relating to the document/editor/fake terminal
6
6
  # implementation.
7
7
  #
8
- # :nocov:
9
8
  module Document
10
9
 
11
10
  extend self
@@ -28,118 +27,66 @@ module Vedeu
28
27
 
29
28
  private
30
29
 
31
- # @example
32
- # Vedeu.trigger(:_editor_execute_, name)
33
- #
34
- # @return [TrueClass]
30
+ # See {file:docs/events/document.md#\_editor_execute_}
35
31
  def editor_execute!
36
32
  Vedeu.bind(:_editor_execute_) do |name|
37
33
  Vedeu.documents.by_name(name).execute
38
34
  end
39
35
  end
40
36
 
41
- # This event attempts to delete the character in the named
42
- # document at the current virtual cursor position.
43
- #
44
- # @example
45
- # Vedeu.trigger(:_editor_delete_character_, name)
46
- #
47
- # @return [TrueClass]
37
+ # See {file:docs/events/document.md#\_editor_delete_character_}
48
38
  def editor_delete_character!
49
39
  Vedeu.bind(:_editor_delete_character_) do |name|
50
40
  Vedeu.documents.by_name(name).delete_character
51
41
  end
52
42
  end
53
43
 
54
- # This event attempts to delete the line in the named document
55
- # at the current virtual cursor position.
56
- #
57
- # @example
58
- # Vedeu.trigger(:_editor_delete_line_, name)
59
- #
60
- # @return [TrueClass]
44
+ # See {file:docs/events/document.md#\_editor_delete_line_}
61
45
  def editor_delete_line!
62
46
  Vedeu.bind(:_editor_delete_line_) do |name|
63
47
  Vedeu.documents.by_name(name).delete_line
64
48
  end
65
49
  end
66
50
 
67
- # This event attempts to move the virtual cursor down by one
68
- # line in the named document.
69
- #
70
- # @example
71
- # Vedeu.trigger(:_editor_down_, name)
72
- #
73
- # @return [TrueClass]
51
+ # See {file:docs/events/document.md#\_editor_down_}
74
52
  def editor_down!
75
53
  Vedeu.bind(:_editor_down_) do |name|
76
54
  Vedeu.documents.by_name(name).down
77
55
  end
78
56
  end
79
57
 
80
- # This event attempts to insert the given character in the named
81
- # document at the current virtual cursor position.
82
- #
83
- # @example
84
- # Vedeu.trigger(:_editor_insert_character_, name, character)
85
- #
86
- # @return [TrueClass]
58
+ # See {file:docs/events/document.md#\_editor_insert_character_}
87
59
  def editor_insert_character!
88
60
  Vedeu.bind(:_editor_insert_character_) do |name, character|
89
61
  Vedeu.documents.by_name(name).insert_character(character)
90
62
  end
91
63
  end
92
64
 
93
- # This event attempts to insert a new line in the named document
94
- # at the current virtual cursor position.
95
- #
96
- # @example
97
- # Vedeu.trigger(:_editor_insert_line_, name)
98
- #
99
- # @return [TrueClass]
65
+ # See {file:docs/events/document.md#\_editor_insert_line_}
100
66
  def editor_insert_line!
101
67
  Vedeu.bind(:_editor_insert_line_) do |name|
102
68
  Vedeu.documents.by_name(name).insert_line
103
69
  end
104
70
  end
105
71
 
106
- # This event attempts to move the virtual cursor left by one
107
- # character in the named document.
108
- #
109
- # @example
110
- # Vedeu.trigger(:_editor_left_, name)
111
- #
112
- # @return [TrueClass]
72
+ # See {file:docs/events/document.md#\_editor_left_}
113
73
  def editor_left!
114
74
  Vedeu.bind(:_editor_left_) { |name| Vedeu.documents.by_name(name).left }
115
75
  end
116
76
 
117
- # This event attempts to move the virtual cursor right by one
118
- # character in the named document.
119
- #
120
- # @example
121
- # Vedeu.trigger(:_editor_right_, name)
122
- #
123
- # @return [TrueClass]
77
+ # See {file:docs/events/document.md#\_editor_right_}
124
78
  def editor_right!
125
79
  Vedeu.bind(:_editor_right_) do |name|
126
80
  Vedeu.documents.by_name(name).right
127
81
  end
128
82
  end
129
83
 
130
- # This event attempts to move the virtual cursor up by one line
131
- # in the named document.
132
- #
133
- # @example
134
- # Vedeu.trigger(:_editor_up_, name)
135
- #
136
- # @return [TrueClass]
84
+ # See {file:docs/events/document.md#\_editor_up_}
137
85
  def editor_up!
138
86
  Vedeu.bind(:_editor_up_) { |name| Vedeu.documents.by_name(name).up }
139
87
  end
140
88
 
141
89
  end # Document
142
- # :nocov:
143
90
 
144
91
  end # Bindings
145
92