vedeu 0.6.27 → 0.6.28

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f676ea7902c40adea7f5844815c2bd92cc0524ca
4
- data.tar.gz: 55d28506df00da6be9d8db123c9f5cc3475b154a
3
+ metadata.gz: 8e78a39e26891252b15013c3ee2e5b3d9255a824
4
+ data.tar.gz: 72ae82abfadbc68b4877b21379d086ddd552249d
5
5
  SHA512:
6
- metadata.gz: 2ad1f1eb8361880265d53dcc03a62684ef9485c967c40022e012e08080135255da79b44365388e05f8947018f73bc4aa121ba5f0bb96885c1936d7dc7f56ca53
7
- data.tar.gz: a49319ea6f19f09d106606a076b5db4a2985caacaa67572173a7495e156e8f4319feb8d1afd3580eb161328f7dddc9d30df171fe30703fd4e271359904db5789
6
+ metadata.gz: 06071e418374792ba1b007ececa0d47b04e8ef53290a821b1e8fe99283cac3e872f09c667a911a0f6f54e3c01490bacbfbcae47180b373244a678967f0d5c6c4
7
+ data.tar.gz: 09d5fe864aff632e25baf9b1ff0a0b0215e6e5ba5c5874fac7e4950ed4293b7410fc25229b54e31340d00c484e3a5e325f47ed69720d3190034fc38f1c00dc0f
data/docs/cursor.md CHANGED
@@ -4,15 +4,75 @@
4
4
  Each interface defined in Vedeu will have a separate cursor named,
5
5
  conveniently after the interface itself.
6
6
 
7
- - The cursor can moved left, right, up or down via events.
7
+ - The cursor can moved left, right, up or down via events; whether
8
+ visible or not.
8
9
  - The cursor can be shown or hidden (independently of the interface).
9
10
  - The cursor may not be drawn on the border of the interface if a
10
11
  border is defined and visible for any side of the interface.
11
- - The cursor may not be drawn outside of the geometry of the interface
12
- if a border is not defined or is invisible for the interface.
12
+ - The cursor may not be drawn outside of the geometry of the
13
+ interface, even if a border is not defined or is invisible for the
14
+ interface.
15
+ - The cursor may not be drawn outside of the boundary of the visible
16
+ terminal.
13
17
  - The position of the cursor is remembered for each interface.
14
18
  - The cursor determines that which is shown in the interface via its
15
19
  offset (this allows content to be larger than the interface size and
16
20
  therefore 'scrolling').
17
21
  - The cursor can be refreshed independently of the interface meaning
18
22
  the content of the interface can change position if needed.
23
+
24
+
25
+ ## Cursor Events
26
+
27
+ Note: 'name' is a Symbol unless mentioned otherwise, and can be
28
+ substituted for 'Vedeu.focus' to use the interface currently in focus.
29
+
30
+ ### :\_cursor_origin_
31
+ This event moves the cursor to the interface origin; the top left
32
+ corner of the named interface.
33
+
34
+ Vedeu.trigger(:_cursor_origin_, name)
35
+ Vedeu.trigger(:_cursor_reset_, name)
36
+
37
+ ### :\_cursor_position_
38
+ To ascertain the position of a cursor in a named interface, use the
39
+ following event (substituting 'name' for the interface name):
40
+
41
+ Vedeu.trigger(:_cursor_position_, name)
42
+
43
+ If you want to know where the cursor is without knowing the interface
44
+ name, you can check which interface is in focus:
45
+
46
+ Vedeu.trigger(:_cursor_position_, Vedeu.focus)
47
+
48
+ ### :\_cursor_reposition_
49
+ Moves the cursor to a relative position inside the interface.
50
+
51
+ Vedeu.trigger(:_cursor_reposition_, name, y, x)
52
+
53
+ ## Cursor Movement Events
54
+
55
+ Adjusts the position of the named cursor or view in the direction
56
+ specified. If 'name' is unknown, using 'Vedeu.focus' will use the
57
+ interface currently in focus.
58
+
59
+ ### :\_cursor_left_
60
+
61
+ Vedeu.trigger(:_cursor_left_, name)
62
+ Vedeu.trigger(:_cursor_left_, Vedeu.focus)
63
+
64
+ ### :\_cursor_down_
65
+
66
+ Vedeu.trigger(:_cursor_down_, name)
67
+ Vedeu.trigger(:_cursor_down_, Vedeu.focus)
68
+
69
+ ### :\_cursor_up_
70
+
71
+ Vedeu.trigger(:_cursor_up_, name)
72
+ Vedeu.trigger(:_cursor_up_, Vedeu.focus)
73
+
74
+ ### :\_cursor_right_
75
+
76
+ Vedeu.trigger(:_cursor_right_, name)
77
+ Vedeu.trigger(:_cursor_right_, Vedeu.focus)
78
+
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Application Events
4
4
 
5
- ### :_goto_
5
+ ### :\_goto_
6
6
  Call a client application controller's action with parameters.
7
7
 
8
8
  Vedeu.trigger(:_goto_,
@@ -4,29 +4,29 @@
4
4
 
5
5
  Note: 'name' is a Symbol unless mentioned otherwise.
6
6
 
7
- ### :_editor_execute_
7
+ ### :\_editor_execute_
8
8
 
9
9
  Vedeu.trigger(:_editor_execute_, name)
10
10
 
11
- ### :_editor_delete_character_
11
+ ### :\_editor_delete_character_
12
12
  This event attempts to delete the character in the named
13
13
  document at the current virtual cursor position.
14
14
 
15
15
  Vedeu.trigger(:_editor_delete_character_, name)
16
16
 
17
- ### :_editor_delete_line_
17
+ ### :\_editor_delete_line_
18
18
  This event attempts to delete the line in the named document
19
19
  at the current virtual cursor position.
20
20
 
21
21
  Vedeu.trigger(:_editor_delete_line_, name)
22
22
 
23
- ### :_editor_down_
23
+ ### :\_editor_down_
24
24
  This event attempts to move the virtual cursor down by one
25
25
  line in the named document.
26
26
 
27
27
  Vedeu.trigger(:_editor_down_, name)
28
28
 
29
- ### :_editor_insert_character_
29
+ ### :\_editor_insert_character_
30
30
  This event attempts to insert the given character in the named
31
31
  document at the current virtual cursor position.
32
32
 
@@ -34,25 +34,25 @@ Note: 'character' is a string.
34
34
 
35
35
  Vedeu.trigger(:_editor_insert_character_, name, character)
36
36
 
37
- ### :_editor_insert_line_
37
+ ### :\_editor_insert_line_
38
38
  This event attempts to insert a new line in the named document
39
39
  at the current virtual cursor position.
40
40
 
41
41
  Vedeu.trigger(:_editor_insert_line_, name)
42
42
 
43
- ### :_editor_left_
43
+ ### :\_editor_left_
44
44
  This event attempts to move the virtual cursor left by one
45
45
  character in the named document.
46
46
 
47
47
  Vedeu.trigger(:_editor_left_, name)
48
48
 
49
- ### :_editor_right_
49
+ ### :\_editor_right_
50
50
  This event attempts to move the virtual cursor right by one
51
51
  character in the named document.
52
52
 
53
53
  Vedeu.trigger(:_editor_right_, name)
54
54
 
55
- ### :_editor_up_
55
+ ### :\_editor_up_
56
56
  This event attempts to move the virtual cursor up by one line
57
57
  in the named document.
58
58
 
data/docs/events/drb.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## DRB Events
4
4
 
5
- ### :_drb_input_
5
+ ### :\_drb_input_
6
6
  Triggering this event will send input to the running application as
7
7
  long as it has the DRb server running.
8
8
 
@@ -10,11 +10,11 @@ Note: See {Vedeu::Distributed::Server#input} for parameter details.
10
10
 
11
11
  Vedeu.trigger(:_drb_input_, data, type)
12
12
 
13
- ### :_drb_retrieve_output_
13
+ ### :\_drb_retrieve_output_
14
14
 
15
15
  Vedeu.trigger(:_drb_retrieve_output_)
16
16
 
17
- ### :_drb_store_output_
17
+ ### :\_drb_store_output_
18
18
  Triggering this event with 'data' will push data into the running
19
19
  application's virtual buffer.
20
20
 
@@ -22,25 +22,25 @@ Note: See {Vedeu::Terminal::Buffer#write} for parameter details.
22
22
 
23
23
  Vedeu.trigger(:_drb_store_output_, data)
24
24
 
25
- ### :_drb_restart_
25
+ ### :\_drb_restart_
26
26
  Use the DRb server to request the client application to restart.
27
27
 
28
28
  Vedeu.trigger(:_drb_restart_)
29
29
  Vedeu.drb_restart
30
30
 
31
- ### :_drb_start_
31
+ ### :\_drb_start_
32
32
  Use the DRb server to request the client application to start.
33
33
 
34
34
  Vedeu.trigger(:_drb_start_)
35
35
  Vedeu.drb_start
36
36
 
37
- ### :_drb_status_
37
+ ### :\_drb_status_
38
38
  Use the DRb server to request the status of the client application.
39
39
 
40
40
  Vedeu.trigger(:_drb_status_)
41
41
  Vedeu.drb_status
42
42
 
43
- ### :_drb_stop_
43
+ ### :\_drb_stop_
44
44
  Use the DRb server to request the client application to stop.
45
45
 
46
46
  Vedeu.trigger(:_drb_stop_)
data/docs/events/focus.md CHANGED
@@ -4,21 +4,21 @@
4
4
 
5
5
  Note: 'name' is a Symbol unless mentioned otherwise.
6
6
 
7
- ### :_focus_by_name_
7
+ ### :\_focus_by_name_
8
8
  When triggered with an interface name will focus that interface and
9
9
  restore the cursor position and visibility.
10
10
 
11
11
  Vedeu.trigger(:_focus_by_name_, name) # or
12
12
  Vedeu.focus_by_name(name)
13
13
 
14
- ### :_focus_next_
14
+ ### :\_focus_next_
15
15
  When triggered will focus the next visible interface and restore the
16
16
  cursor position and visibility.
17
17
 
18
18
  Vedeu.trigger(:_focus_next_) # or
19
19
  Vedeu.focus_next
20
20
 
21
- ### :_focus_prev_
21
+ ### :\_focus_prev_
22
22
  When triggered will focus the previous visible interface and restore
23
23
  the cursor position and visibility.
24
24
 
data/docs/events/menu.md CHANGED
@@ -4,55 +4,55 @@
4
4
 
5
5
  Note: 'name' is a Symbol unless mentioned otherwise.
6
6
 
7
- ### :_menu_bottom_
7
+ ### :\_menu_bottom_
8
8
  Makes the last menu item the current menu item.
9
9
 
10
10
  Vedeu.trigger(:_menu_bottom_, name)
11
11
 
12
- ### :_menu_current_
12
+ ### :\_menu_current_
13
13
  Returns the current menu item.
14
14
 
15
15
  Vedeu.trigger(:_menu_current_, name)
16
16
 
17
- ### :_menu_deselect_
17
+ ### :\_menu_deselect_
18
18
  Deselects all menu items.
19
19
 
20
20
  Vedeu.trigger(:_menu_deselect_, name)
21
21
 
22
- ### :_menu_items_
22
+ ### :\_menu_items_
23
23
  Returns all the menu items with respective `current` or `selected`
24
24
  boolean indicators.
25
25
 
26
26
  Vedeu.trigger(:_menu_items_, name)
27
27
 
28
- ### :_menu_next_
28
+ ### :\_menu_next_
29
29
  Makes the next menu item the current menu item, until it reaches the
30
30
  last item.
31
31
 
32
32
  Vedeu.trigger(:_menu_next_, name)
33
33
 
34
- ### :_menu_prev_
34
+ ### :\_menu_prev_
35
35
  Makes the previous menu item the current menu item, until it reaches
36
36
  the first item.
37
37
 
38
38
  Vedeu.trigger(:_menu_prev_, name)
39
39
 
40
- ### :_menu_selected_
40
+ ### :\_menu_selected_
41
41
  Returns the selected menu item.
42
42
 
43
43
  Vedeu.trigger(:_menu_selected_, name)
44
44
 
45
- ### :_menu_select_
45
+ ### :\_menu_select_
46
46
  Makes the current menu item also the selected menu item.
47
47
 
48
48
  Vedeu.trigger(:_menu_select_, name)
49
49
 
50
- ### :_menu_top_
50
+ ### :\_menu_top_
51
51
  Makes the first menu item the current menu item.
52
52
 
53
53
  Vedeu.trigger(:_menu_top_, name)
54
54
 
55
- ### :_menu_view_
55
+ ### :\_menu_view_
56
56
  Returns a subset of the menu items; starting at the current item to
57
57
  the last item.
58
58
 
@@ -4,50 +4,11 @@
4
4
 
5
5
  Note: 'name' is a Symbol unless mentioned otherwise.
6
6
 
7
- ### :_cursor_origin_
8
- This event moves the cursor to the interface origin; the top left
9
- corner of the named interface.
7
+ For cursor related movement events, please refer to
8
+ {file:docs/cursor.md} Cursors.
10
9
 
11
- Vedeu.trigger(:_cursor_origin_, name)
12
- Vedeu.trigger(:_cursor_reset_, name)
13
10
 
14
- ### :_cursor_position_
15
- When triggered will return the current position of the cursor.
16
-
17
- Vedeu.trigger(:_cursor_position_, name)
18
-
19
- ### :_cursor_reposition_
20
- Moves the cursor to a relative position inside the interface.
21
-
22
- Vedeu.trigger(:_cursor_reposition_, name, y, x)
23
-
24
- ### :_cursor_(up, down, left, right)_
25
- Adjusts the position of the cursor or view.
26
-
27
- When a name is not given, the cursor in the interface which is
28
- currently in focus should move in the direction specified.
29
-
30
- Vedeu.trigger(:_cursor_left_, name)
31
- Vedeu.trigger(:_cursor_left_)
32
- Vedeu.trigger(:_cursor_right_)
33
- Vedeu.trigger(:_cursor_up_)
34
- Vedeu.trigger(:_cursor_down_)
35
-
36
- - The cursor or view may not be visible, but it will still move if
37
- requested.
38
- - The cursor will not exceed the border or boundary of the interface,
39
- or boundary of the visible terminal.
40
- - The cursor will move freely within the bounds of the interface,
41
- irrespective of content.
42
- - The view will not exceed the boundary of the visible terminal,
43
- though its offset may (this means content will appear to have
44
- scrolled).
45
- - The view will move freely within the bounds of the interface,
46
- irrespective of content.
47
-
48
- ### :_view_(up, down, left, right)_
49
-
50
- See {file:docs/events.md#\_cursor__up_down_left_right_}
11
+ ### :\_view_(up, down, left, right)_
51
12
 
52
13
  Please note that the name of the view is required for these events.
53
14
 
@@ -56,4 +17,4 @@ Please note that the name of the view is required for these events.
56
17
  Vedeu.trigger(:_view_right_, name)
57
18
  Vedeu.trigger(:_view_up_, name)
58
19
 
59
- Each of the :_view_* events has an alias, :_geometry_* if you prefer.
20
+ Each of the :\_view_* events has an alias, :\_geometry_* if you prefer.
@@ -4,7 +4,7 @@
4
4
 
5
5
  Note: 'name' is a Symbol unless mentioned otherwise.
6
6
 
7
- ### :_refresh_
7
+ ### :\_refresh_
8
8
  Refreshes all registered interfaces.
9
9
 
10
10
  The interfaces will be refreshed in z-index order, meaning that
@@ -14,28 +14,28 @@ will be still refreshed in memory but not shown.
14
14
 
15
15
  Vedeu.trigger(:_refresh_)
16
16
 
17
- ### :_refresh_border_
17
+ ### :\_refresh_border_
18
18
  Will cause the named border to refresh.
19
19
 
20
20
  Vedeu.trigger(:_refresh_border_, name)
21
21
 
22
- ### :_refresh_cursor_
22
+ ### :\_refresh_cursor_
23
23
  Will cause the named cursor to refresh, or the cursor of the interface
24
24
  which is currently in focus.
25
25
 
26
26
  Vedeu.trigger(:_refresh_cursor_, name)
27
27
 
28
- ### :_refresh_group_
28
+ ### :\_refresh_group_
29
29
  Will cause all interfaces in the named group to refresh.
30
30
 
31
31
  Vedeu.trigger(:_refresh_group_, name)
32
32
 
33
- ### :_refresh_view_
33
+ ### :\_refresh_view_
34
34
  Will cause the named view to refresh.
35
35
 
36
36
  Vedeu.trigger(:_refresh_view_, name)
37
37
 
38
- ### :_refresh_view_content_
38
+ ### :\_refresh_view_content_
39
39
  Will cause only the content of the named view to refresh.
40
40
 
41
41
  Vedeu.trigger(:_refresh_view_content_, name)
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## System Events
4
4
 
5
- ### :_cleanup_
5
+ ### :\_cleanup_
6
6
  Vedeu triggers this event when `:_exit_` is triggered. You can hook
7
7
  into this to perform a special action before the application
8
8
  terminates. Saving the user's work, session or preferences might be
@@ -10,13 +10,13 @@ popular here.
10
10
 
11
11
  Vedeu.trigger(:_exit_)
12
12
 
13
- ### :_command_
13
+ ### :\_command_
14
14
  Will cause the triggering of the `:command` event; which you should
15
15
  define to 'do things'.
16
16
 
17
17
  Vedeu.trigger(:_command_, command)
18
18
 
19
- ### :_editor_
19
+ ### :\_editor_
20
20
  This event is called by {Vedeu::Input::Capture#read}. When
21
21
  invoked, the key will be passed to the editor for currently
22
22
  focussed view.
@@ -26,21 +26,21 @@ represented by Symbols.
26
26
 
27
27
  Vedeu.trigger(:_editor_, key)
28
28
 
29
- ### :_exit_
29
+ ### :\_exit_
30
30
  When triggered, Vedeu will trigger a `:cleanup` event which you can
31
31
  define (to save files, etc) and attempt to exit.
32
32
 
33
33
  Vedeu.trigger(:_exit_)
34
34
  Vedeu.exit
35
35
 
36
- ### :_initialize_
36
+ ### :\_initialize_
37
37
  Vedeu triggers this event when it is ready to enter the main loop.
38
38
  Client applications can listen for this event and perform some
39
39
  action(s), like render the first screen, interface or make a sound.
40
40
 
41
41
  Vedeu.trigger(:_initialize_)
42
42
 
43
- ### :_keypress_
43
+ ### :\_keypress_
44
44
  Will cause the triggering of the `:key` event; which you should define
45
45
  to 'do things'. If the `escape` key is pressed, then `key` is
46
46
  triggered with the argument `:escape`, also an internal event
@@ -50,7 +50,7 @@ can be found here: {Vedeu::Input::Capture}.
50
50
 
51
51
  Vedeu.trigger(:_keypress_, key)
52
52
 
53
- ### :_log_
53
+ ### :\_log_
54
54
  When triggered with a message will cause Vedeu to log the message if
55
55
  logging is enabled in the configuration.
56
56
 
@@ -58,7 +58,7 @@ Note: 'message' is a String.
58
58
 
59
59
  Vedeu.trigger(:_log_, message)
60
60
 
61
- ### :_mode_switch_
61
+ ### :\_mode_switch_
62
62
  When triggered (by default, after the user presses `escape`), Vedeu
63
63
  switches between modes of the terminal. The idea here being
64
64
  that the raw mode is for single keypress actions, whilst fake and
data/docs/events/view.md CHANGED
@@ -4,20 +4,20 @@
4
4
 
5
5
  Note: 'name' is a Symbol unless mentioned otherwise.
6
6
 
7
- ### :_maximise_
7
+ ### :\_maximise_
8
8
  Maximising an interface.
9
9
 
10
10
  Vedeu.trigger(:_maximise_, name)
11
11
 
12
12
  See {Vedeu::Geometry::Geometry#maximise}
13
13
 
14
- ### :_resize_
14
+ ### :\_resize_
15
15
  When triggered will cause Vedeu to trigger the `:_clear_` and
16
16
  `:_refresh_` events. Please see those events for their behaviour.
17
17
 
18
18
  Vedeu.trigger(:_resize_)
19
19
 
20
- ### :_unmaximise_
20
+ ### :\_unmaximise_
21
21
  Unmaximising an interface.
22
22
 
23
23
  Vedeu.trigger(:_unmaximise_, name)
@@ -4,32 +4,32 @@
4
4
 
5
5
  Note: 'name' is a Symbol unless mentioned otherwise.
6
6
 
7
- ### :_clear_
7
+ ### :\_clear_
8
8
  Clears the whole terminal space.
9
9
 
10
10
  Vedeu.trigger(:_clear_)
11
11
  Vedeu.clear
12
12
 
13
- ### :_clear_group_
13
+ ### :\_clear_group_
14
14
  Clears the spaces occupied by the interfaces belonging to the named
15
15
  group.
16
16
 
17
17
  Vedeu.trigger(:_clear_group_, name)
18
18
  Vedeu.clear_by_group(name)
19
19
 
20
- ### :_clear_view_
20
+ ### :\_clear_view_
21
21
  Clears the named view/interface area.
22
22
 
23
23
  Vedeu.trigger(:_clear_view_, name)
24
24
  Vedeu.clear_by_name(name)
25
25
 
26
- ### :_clear_view_content_
26
+ ### :\_clear_view_content_
27
27
  Clears only the content of the named view/interface area.
28
28
 
29
29
  Vedeu.trigger(:_clear_view_content_, name)
30
30
  Vedeu.clear_content_by_name(name)
31
31
 
32
- ### :_hide_cursor_
32
+ ### :\_hide_cursor_
33
33
  Hide the cursor of the named interface or when a name is not given,
34
34
  the interface currently in focus.
35
35
 
@@ -37,19 +37,19 @@ the interface currently in focus.
37
37
  Vedeu.trigger(:_cursor_hide_, name)
38
38
  Vedeu.hide_cursor(name)
39
39
 
40
- ### :_hide_group_
40
+ ### :\_hide_group_
41
41
  Hiding a group of interfaces.
42
42
 
43
43
  Vedeu.trigger(:_hide_group_, name)
44
44
  Vedeu.hide_group(name)
45
45
 
46
- ### :_hide_interface_
46
+ ### :\_hide_interface_
47
47
  Hide an interface by name.
48
48
 
49
49
  Vedeu.trigger(:_hide_interface_, name)
50
50
  Vedeu.hide_interface(name)
51
51
 
52
- ### :_show_cursor_
52
+ ### :\_show_cursor_
53
53
  Show the cursor of the named interface or when a name is not given,
54
54
  the interface currently in focus.
55
55
 
@@ -57,31 +57,31 @@ the interface currently in focus.
57
57
  Vedeu.trigger(:_cursor_show_, name)
58
58
  Vedeu.show_cursor(name)
59
59
 
60
- ### :_show_group_
60
+ ### :\_show_group_
61
61
  Showing a group of interfaces.
62
62
 
63
63
  Vedeu.trigger(:_show_group_, name)
64
64
  Vedeu.show_group(name)
65
65
 
66
- ### :_show_interface_
66
+ ### :\_show_interface_
67
67
  Show an interface by name.
68
68
 
69
69
  Vedeu.trigger(:_show_interface_, name)
70
70
  Vedeu.show_interface(name)
71
71
 
72
- ### :_toggle_cursor_
72
+ ### :\_toggle_cursor_
73
73
  Toggling a cursor.
74
74
 
75
75
  Vedeu.trigger(:_toggle_cursor_, name)
76
76
  Vedeu.toggle_cursor(name)
77
77
 
78
- ### :_toggle_group_
78
+ ### :\_toggle_group_
79
79
  Toggling a group of interfaces.
80
80
 
81
81
  Vedeu.trigger(:_toggle_group_, name)
82
82
  Vedeu.toggle_group(name)
83
83
 
84
- ### :_toggle_interface_
84
+ ### :\_toggle_interface_
85
85
  Toggling an interface.
86
86
 
87
87
  Vedeu.trigger(:_toggle_interface_, name)
data/docs/geometry.md CHANGED
@@ -24,5 +24,5 @@ of the terminal.
24
24
  - Geometry can be maximised- to use all the available terminal space.
25
25
  - It can also be unmaximised- to return to the pre-defined dimensions
26
26
  as mentioned above.
27
- - Geometry like a {file:docs/cursorr.md} Cursor, via events can be
27
+ - Geometry like a {file:docs/cursor.md Cursor}, via events can be
28
28
  moved; left, right, up or down.
data/docs/interfaces.md CHANGED
@@ -6,7 +6,7 @@ Think of interfaces as being discrete sections of the terminal space.
6
6
  - It has a name, which all other aspects of Vedeu will be related.
7
7
  - It has a size, in terms of a width and height, determined by
8
8
  {file:docs/geometry.md Geometry}.
9
- - It can have a {file:docs/border.md} Border.
9
+ - It can have a {file:docs/border.md Border}.
10
10
  - It can be part of a {file:docs/group.md Group}.
11
11
  - An interface is empty unless it has an associated
12
12
  {file:docs/view.md View}.
@@ -13,7 +13,10 @@ require 'vedeu'
13
13
  #
14
14
  class HelloWorldsApp
15
15
 
16
- Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
16
+ Vedeu.bind(:_initialize_) {
17
+ Vedeu.trigger(:_show_view_, :hello)
18
+ Vedeu.trigger(:_refresh_)
19
+ }
17
20
 
18
21
  Vedeu.configure do
19
22
  # Empty configure block is needed.
@@ -69,6 +72,7 @@ class HelloWorldsApp
69
72
  line
70
73
  line { centre "Press 'q' to exit,", width: 24 }
71
74
  line { centre " 'w' to switch worlds.", width: 24 }
75
+ line { centre "#{Vedeu.trigger(:_cursor_position_, Vedeu.focus)" }
72
76
  end
73
77
  end
74
78
  end
@@ -21,6 +21,7 @@ module Vedeu
21
21
  end # Vedeu
22
22
 
23
23
  require 'vedeu/bindings/application'
24
+ require 'vedeu/bindings/cursors'
24
25
  require 'vedeu/bindings/document'
25
26
  require 'vedeu/bindings/drb'
26
27
  require 'vedeu/bindings/menus'
@@ -11,6 +11,7 @@ module Vedeu
11
11
  Vedeu::Events::Repository.reset!
12
12
 
13
13
  Vedeu::Bindings::Application.setup!
14
+ Vedeu::Bindings::Cursors.setup!
14
15
  Vedeu::Bindings::Document.setup!
15
16
  Vedeu::Bindings::DRB.setup!
16
17
  Vedeu::Bindings::Focus.setup!
@@ -30,6 +31,7 @@ module Vedeu
30
31
  # @return [TrueClass]
31
32
  def setup_aliases!
32
33
  Vedeu::Bindings::Application.setup_aliases!
34
+ Vedeu::Bindings::Cursors.setup_aliases!
33
35
  Vedeu::Bindings::Movement.setup_aliases!
34
36
  Vedeu::Bindings::Visibility.setup_aliases!
35
37
 
@@ -0,0 +1,101 @@
1
+ module Vedeu
2
+
3
+ module Bindings
4
+
5
+ # System events relating to movement of cursors.
6
+ #
7
+ module Cursors
8
+
9
+ extend self
10
+
11
+ # Setup events relating to movement. This method is called by
12
+ # Vedeu.
13
+ #
14
+ # @return [TrueClass]
15
+ def setup!
16
+ cursor_left!
17
+ cursor_down!
18
+ cursor_up!
19
+ cursor_right!
20
+ cursor_origin!
21
+ cursor_position!
22
+ cursor_reposition!
23
+ end
24
+
25
+ # @return [TrueClass]
26
+ def setup_aliases!
27
+ Vedeu.bind_alias(:_cursor_reset_, :_cursor_origin_)
28
+ end
29
+
30
+ private
31
+
32
+ # :nocov:
33
+
34
+ # See {file:docs/cursors.md}
35
+ def cursor_left!
36
+ Vedeu.bind(:_cursor_left_) do |name|
37
+ Vedeu.cursors.by_name(name).move_left
38
+
39
+ Vedeu.trigger(:_refresh_cursor_, name)
40
+ end
41
+ end
42
+
43
+ # See {file:docs/cursors.md}
44
+ def cursor_down!
45
+ Vedeu.bind(:_cursor_down_) do |name|
46
+ Vedeu.cursors.by_name(name).move_down
47
+
48
+ Vedeu.trigger(:_refresh_cursor_, name)
49
+ end
50
+ end
51
+
52
+ # See {file:docs/cursors.md}
53
+ def cursor_up!
54
+ Vedeu.bind(:_cursor_up_) do |name|
55
+ Vedeu.cursors.by_name(name).move_up
56
+
57
+ Vedeu.trigger(:_refresh_cursor_, name)
58
+ end
59
+ end
60
+
61
+ # See {file:docs/cursors.md}
62
+ def cursor_right!
63
+ Vedeu.bind(:_cursor_right_) do |name|
64
+ Vedeu.cursors.by_name(name).move_right
65
+
66
+ Vedeu.trigger(:_refresh_cursor_, name)
67
+ end
68
+ end
69
+
70
+ # See {file:docs/cursors.md}
71
+ def cursor_origin!
72
+ Vedeu.bind(:_cursor_origin_) do |name|
73
+ Vedeu.cursors.by_name(name).move_origin
74
+ end
75
+ end
76
+
77
+ # See {file:docs/cursors.md}
78
+ def cursor_position!
79
+ Vedeu.bind(:_cursor_position_) do |name|
80
+ Vedeu.cursors.by_name(name).to_a
81
+ end
82
+ end
83
+
84
+ # See {file:docs/cursors.md}
85
+ def cursor_reposition!
86
+ Vedeu.bind(:_cursor_reposition_) do |name, y, x|
87
+ Vedeu.cursors.by_name(name).reposition(y, x)
88
+
89
+ Vedeu.trigger(:_clear_view_, name)
90
+ Vedeu.trigger(:_refresh_view_, name)
91
+ Vedeu.trigger(:_refresh_cursor_, name)
92
+ end
93
+ end
94
+
95
+ # :nocov:
96
+
97
+ end # Cursors
98
+
99
+ end # Bindings
100
+
101
+ end # Vedeu
@@ -2,7 +2,7 @@ module Vedeu
2
2
 
3
3
  module Bindings
4
4
 
5
- # System events relating to movement of cursors or interfaces.
5
+ # System events relating to movement of interfaces.
6
6
  #
7
7
  module Movement
8
8
 
@@ -13,9 +13,6 @@ module Vedeu
13
13
  #
14
14
  # @return [TrueClass]
15
15
  def setup!
16
- cursor_origin!
17
- cursor_position!
18
- cursor_reposition!
19
16
  directional!
20
17
  end
21
18
 
@@ -25,23 +22,15 @@ module Vedeu
25
22
  Vedeu.bind_alias(:"_geometry_#{direction}_",
26
23
  :"_view_#{direction}_")
27
24
  end
28
-
29
- Vedeu.bind_alias(:_cursor_reset_, :_cursor_origin_)
30
25
  end
31
26
 
32
27
  private
33
28
 
34
29
  # :nocov:
35
30
 
36
- # See {file:docs/events/movement.md#\_cursor_up_down_left_right_}
31
+ # See {file:docs/events/movement.md#\_view_up_down_left_right_}
37
32
  def directional!
38
33
  %w(down left right up).each do |direction|
39
- Vedeu.bind(:"_cursor_#{direction}_") do |name|
40
- Vedeu.cursors.by_name(name).send("move_#{direction}")
41
-
42
- Vedeu.trigger(:_refresh_cursor_, name)
43
- end
44
-
45
34
  Vedeu.bind(:"_view_#{direction}_") do |name|
46
35
  Vedeu.geometries.by_name(name).send("move_#{direction}")
47
36
 
@@ -53,31 +42,6 @@ module Vedeu
53
42
  end
54
43
  end
55
44
 
56
- # See {file:docs/events/movement.md#\_cursor_origin_}
57
- def cursor_origin!
58
- Vedeu.bind(:_cursor_origin_) do |name|
59
- Vedeu.cursors.by_name(name).move_origin
60
- end
61
- end
62
-
63
- # See {file:docs/events/movement.md#\_cursor_position_}
64
- def cursor_position!
65
- Vedeu.bind(:_cursor_position_) do |name|
66
- Vedeu.cursors.by_name(name).position
67
- end
68
- end
69
-
70
- # See {file:docs/events/movement.md#\_cursor_reposition_}
71
- def cursor_reposition!
72
- Vedeu.bind(:_cursor_reposition_) do |name, y, x|
73
- Vedeu.cursors.by_name(name).reposition(y, x)
74
-
75
- Vedeu.trigger(:_clear_view_, name)
76
- Vedeu.trigger(:_refresh_view_, name)
77
- Vedeu.trigger(:_refresh_cursor_, name)
78
- end
79
- end
80
-
81
45
  # :nocov:
82
46
 
83
47
  end # Movement
@@ -82,6 +82,9 @@ module Vedeu
82
82
 
83
83
  # Moves the cursor down by one row.
84
84
  #
85
+ # Vedeu.trigger(:_cursor_down_, name)
86
+ # Vedeu.trigger(:_cursor_down_, Vedeu.focus)
87
+ #
85
88
  # @return [Vedeu::Cursors::Cursor]
86
89
  def move_down
87
90
  @oy += 1
@@ -92,6 +95,9 @@ module Vedeu
92
95
 
93
96
  # Moves the cursor left by one column.
94
97
  #
98
+ # Vedeu.trigger(:_cursor_left_, name)
99
+ # Vedeu.trigger(:_cursor_left_, Vedeu.focus)
100
+ #
95
101
  # @return [Vedeu::Cursors::Cursor]
96
102
  def move_left
97
103
  @ox -= 1
@@ -102,6 +108,9 @@ module Vedeu
102
108
 
103
109
  # Moves the cursor to the top left of the named interface.
104
110
  #
111
+ # Vedeu.trigger(:_cursor_origin_, name)
112
+ # Vedeu.trigger(:_cursor_origin_, Vedeu.focus)
113
+ #
105
114
  # @return [Vedeu::Cursors::Cursor]
106
115
  def move_origin
107
116
  Vedeu::Cursors::Cursor.store(
@@ -110,6 +119,9 @@ module Vedeu
110
119
 
111
120
  # Moves the cursor right by one column.
112
121
  #
122
+ # Vedeu.trigger(:_cursor_right_, name)
123
+ # Vedeu.trigger(:_cursor_right_, Vedeu.focus)
124
+ #
113
125
  # @return [Vedeu::Cursors::Cursor]
114
126
  def move_right
115
127
  @ox += 1
@@ -120,6 +132,9 @@ module Vedeu
120
132
 
121
133
  # Moves the cursor up by one row.
122
134
  #
135
+ # Vedeu.trigger(:_cursor_up_, name)
136
+ # Vedeu.trigger(:_cursor_up_, Vedeu.focus)
137
+ #
123
138
  # @return [Vedeu::Cursors::Cursor]
124
139
  def move_up
125
140
  @oy -= 1
@@ -150,6 +165,11 @@ module Vedeu
150
165
  new_attributes(coordinate.y_position, coordinate.x_position, oy, ox))
151
166
  end
152
167
 
168
+ # @return [Array<Fixnum>]
169
+ def to_a
170
+ position.to_a
171
+ end
172
+
153
173
  # Returns an escape sequence to position the cursor and set its
154
174
  # visibility. When passed a block, will position the cursor,
155
175
  # yield and return the original position.
@@ -166,7 +186,10 @@ module Vedeu
166
186
  # currently focussed interface.
167
187
  #
168
188
  # @example
189
+ # Vedeu.trigger(:_hide_cursor_, name)
190
+ # Vedeu.trigger(:_hide_cursor_, Vedeu.focus)
169
191
  # Vedeu.hide_cursor(name)
192
+ # Vedeu.hide_cursor(Vedeu.focus)
170
193
  #
171
194
  # @return [Vedeu::Models::Escape]
172
195
  def hide
@@ -198,7 +221,10 @@ module Vedeu
198
221
  # currently focussed interface.
199
222
  #
200
223
  # @example
224
+ # Vedeu.trigger(:_show_cursor_, name)
225
+ # Vedeu.trigger(:_show_cursor_, Vedeu.focus)
201
226
  # Vedeu.show_cursor(name)
227
+ # Vedeu.show_cursor(Vedeu.focus)
202
228
  #
203
229
  # @return [Vedeu::Models::Escape]
204
230
  def show
@@ -244,11 +244,7 @@ module Vedeu
244
244
 
245
245
  model.add(model.member.build(attributes, &block))
246
246
  end
247
-
248
- # @return [Vedeu::Views::Line]
249
- def line(value = '')
250
- lines { line(value) }
251
- end
247
+ alias_method :line, :lines
252
248
 
253
249
  end # View
254
250
 
@@ -156,7 +156,7 @@ module Vedeu
156
156
  members: Set.new,
157
157
  name: '',
158
158
  repository: Vedeu.groups,
159
- visible: false,
159
+ visible: true,
160
160
  }
161
161
  end
162
162
 
@@ -116,7 +116,7 @@ module Vedeu
116
116
  parent: nil,
117
117
  repository: Vedeu.interfaces,
118
118
  style: :normal,
119
- visible: false,
119
+ visible: true,
120
120
  zindex: 0,
121
121
  }
122
122
  end
data/lib/vedeu/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # The current version of Vedeu.
4
- VERSION = '0.6.27'.freeze
4
+ VERSION = '0.6.28'.freeze
5
5
 
6
6
  end
@@ -0,0 +1,24 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Bindings
6
+
7
+ describe Cursors do
8
+
9
+ context 'the movement events are defined' do
10
+ it { Vedeu.bound?(:_cursor_down_).must_equal(true) }
11
+ it { Vedeu.bound?(:_cursor_left_).must_equal(true) }
12
+ it { Vedeu.bound?(:_cursor_origin_).must_equal(true) }
13
+ it { Vedeu.bound?(:_cursor_position_).must_equal(true) }
14
+ it { Vedeu.bound?(:_cursor_reposition_).must_equal(true) }
15
+ it { Vedeu.bound?(:_cursor_reset_).must_equal(true) }
16
+ it { Vedeu.bound?(:_cursor_right_).must_equal(true) }
17
+ it { Vedeu.bound?(:_cursor_up_).must_equal(true) }
18
+ end
19
+
20
+ end # Cursors
21
+
22
+ end # Bindings
23
+
24
+ end # Vedeu
@@ -7,14 +7,6 @@ module Vedeu
7
7
  describe Movement do
8
8
 
9
9
  context 'the movement events are defined' do
10
- it { Vedeu.bound?(:_cursor_down_).must_equal(true) }
11
- it { Vedeu.bound?(:_cursor_left_).must_equal(true) }
12
- it { Vedeu.bound?(:_cursor_origin_).must_equal(true) }
13
- it { Vedeu.bound?(:_cursor_position_).must_equal(true) }
14
- it { Vedeu.bound?(:_cursor_reposition_).must_equal(true) }
15
- it { Vedeu.bound?(:_cursor_reset_).must_equal(true) }
16
- it { Vedeu.bound?(:_cursor_right_).must_equal(true) }
17
- it { Vedeu.bound?(:_cursor_up_).must_equal(true) }
18
10
  it { Vedeu.bound?(:_geometry_down_).must_equal(true) }
19
11
  it { Vedeu.bound?(:_geometry_left_).must_equal(true) }
20
12
  it { Vedeu.bound?(:_geometry_right_).must_equal(true) }
@@ -250,6 +250,13 @@ module Vedeu
250
250
  it { subject.oy.must_equal(3) }
251
251
  end
252
252
 
253
+ describe '#to_a' do
254
+ subject { instance.to_a }
255
+
256
+ it { subject.must_be_instance_of(Array) }
257
+ it { subject.must_equal([8, 19]) }
258
+ end
259
+
253
260
  describe '#to_s' do
254
261
  let(:visible) { true }
255
262
 
data/vedeu.gemspec CHANGED
@@ -37,5 +37,4 @@ Gem::Specification.new do |spec|
37
37
  spec.add_dependency 'ruby-prof', '0.15.8'
38
38
  spec.add_dependency 'thor', '0.19.1'
39
39
  spec.add_dependency 'vedeu_cli', '0.0.7'
40
-
41
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.27
4
+ version: 0.6.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-06 00:00:00.000000000 Z
11
+ date: 2015-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -299,6 +299,7 @@ files:
299
299
  - lib/vedeu/bindings/all.rb
300
300
  - lib/vedeu/bindings/application.rb
301
301
  - lib/vedeu/bindings/bindings.rb
302
+ - lib/vedeu/bindings/cursors.rb
302
303
  - lib/vedeu/bindings/document.rb
303
304
  - lib/vedeu/bindings/drb.rb
304
305
  - lib/vedeu/bindings/focus.rb
@@ -501,6 +502,7 @@ files:
501
502
  - test/lib/vedeu/application/view_test.rb
502
503
  - test/lib/vedeu/bindings/application_test.rb
503
504
  - test/lib/vedeu/bindings/bindings_test.rb
505
+ - test/lib/vedeu/bindings/cursors_test.rb
504
506
  - test/lib/vedeu/bindings/document_test.rb
505
507
  - test/lib/vedeu/bindings/drb_test.rb
506
508
  - test/lib/vedeu/bindings/focus_test.rb
@@ -714,6 +716,7 @@ test_files:
714
716
  - test/lib/vedeu/application/view_test.rb
715
717
  - test/lib/vedeu/bindings/application_test.rb
716
718
  - test/lib/vedeu/bindings/bindings_test.rb
719
+ - test/lib/vedeu/bindings/cursors_test.rb
717
720
  - test/lib/vedeu/bindings/document_test.rb
718
721
  - test/lib/vedeu/bindings/drb_test.rb
719
722
  - test/lib/vedeu/bindings/focus_test.rb