vedeu 0.6.68 → 0.6.69

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +34 -66
  3. data/docs/api.md +3 -3
  4. data/docs/borders.md +3 -3
  5. data/docs/cursors.md +109 -10
  6. data/docs/debugging.md +2 -2
  7. data/docs/dsl.md +2 -2
  8. data/docs/events/application.md +1 -1
  9. data/docs/events/document.md +9 -9
  10. data/docs/events/drb.md +7 -7
  11. data/docs/events/focus.md +3 -3
  12. data/docs/events/menu.md +10 -10
  13. data/docs/events/movement.md +5 -3
  14. data/docs/events/refresh.md +5 -5
  15. data/docs/events/system.md +8 -8
  16. data/docs/events/view.md +4 -4
  17. data/docs/events/visibility.md +10 -32
  18. data/docs/input.md +1 -1
  19. data/lib/vedeu/colours/background.rb +4 -9
  20. data/lib/vedeu/colours/foreground.rb +4 -9
  21. data/lib/vedeu/colours/translator.rb +8 -3
  22. data/lib/vedeu/cursors/all.rb +1 -0
  23. data/lib/vedeu/{geometries → cursors}/coordinate.rb +4 -4
  24. data/lib/vedeu/cursors/cursor.rb +10 -10
  25. data/lib/vedeu/cursors/dsl.rb +3 -27
  26. data/lib/vedeu/cursors/reposition.rb +4 -4
  27. data/lib/vedeu/esc/esc.rb +13 -17
  28. data/lib/vedeu/geometries/{alignment.rb → alignment/alignment.rb} +0 -0
  29. data/lib/vedeu/geometries/alignment/all.rb +11 -0
  30. data/lib/vedeu/geometries/{horizontal_alignment.rb → alignment/horizontal_alignment.rb} +0 -0
  31. data/lib/vedeu/geometries/{vertical_alignment.rb → alignment/vertical_alignment.rb} +0 -0
  32. data/lib/vedeu/geometries/all.rb +4 -12
  33. data/lib/vedeu/geometries/area/all.rb +12 -0
  34. data/lib/vedeu/geometries/{area.rb → area/area.rb} +0 -0
  35. data/lib/vedeu/geometries/{dimension.rb → area/dimension.rb} +0 -0
  36. data/lib/vedeu/geometries/{x_dimension.rb → area/x_dimension.rb} +0 -0
  37. data/lib/vedeu/geometries/{y_dimension.rb → area/y_dimension.rb} +0 -0
  38. data/lib/vedeu/geometries/dsl/all.rb +11 -0
  39. data/lib/vedeu/geometries/{dsl.rb → dsl/dsl.rb} +0 -0
  40. data/lib/vedeu/geometries/{grid.rb → dsl/grid.rb} +0 -0
  41. data/lib/vedeu/geometries/{validator.rb → dsl/validator.rb} +0 -0
  42. data/lib/vedeu/input/raw.rb +5 -0
  43. data/lib/vedeu/input/read.rb +2 -2
  44. data/lib/vedeu/output/compressor.rb +1 -1
  45. data/lib/vedeu/output/compressor_cache.rb +7 -0
  46. data/lib/vedeu/terminal/terminal.rb +4 -4
  47. data/lib/vedeu/version.rb +1 -1
  48. data/test/lib/vedeu/{geometries/coordinate.rb → cursors/coordinate_test.rb} +4 -4
  49. data/test/lib/vedeu/esc/esc_test.rb +18 -0
  50. data/test/lib/vedeu/geometries/{alignment_test.rb → alignment/alignment_test.rb} +0 -0
  51. data/test/lib/vedeu/geometries/{horizontal_alignment_test.rb → alignment/horizontal_alignment_test.rb} +0 -0
  52. data/test/lib/vedeu/geometries/{vertical_alignment_test.rb → alignment/vertical_alignment_test.rb} +0 -0
  53. data/test/lib/vedeu/geometries/{area_test.rb → area/area_test.rb} +0 -0
  54. data/test/lib/vedeu/geometries/{dimension_test.rb → area/dimension_test.rb} +0 -0
  55. data/test/lib/vedeu/geometries/{x_dimension_test.rb → area/x_dimension_test.rb} +0 -0
  56. data/test/lib/vedeu/geometries/{y_dimension_test.rb → area/y_dimension_test.rb} +0 -0
  57. data/test/lib/vedeu/geometries/{dsl_test.rb → dsl/dsl_test.rb} +0 -0
  58. data/test/lib/vedeu/geometries/{grid_test.rb → dsl/grid_test.rb} +0 -0
  59. data/test/lib/vedeu/geometries/{validator_test.rb → dsl/validator_test.rb} +0 -0
  60. data/vedeu.gemspec +2 -2
  61. metadata +42 -39
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,31 +10,31 @@ 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
  See {Vedeu::Buffers::Terminal#output}
15
15
 
16
- ### `:\_drb_store_output\_`
16
+ ### `:_drb_store_output_`
17
17
  See {Vedeu::Buffers::Terminal#write}
18
18
 
19
- ### `:\_drb_restart\_`
19
+ ### `:_drb_restart_`
20
20
  Use the DRb server to request the client application to restart.
21
21
 
22
22
  Vedeu.trigger(:_drb_restart_)
23
23
  Vedeu.drb_restart
24
24
 
25
- ### `:\_drb_start\_`
25
+ ### `:_drb_start_`
26
26
  Use the DRb server to request the client application to start.
27
27
 
28
28
  Vedeu.trigger(:_drb_start_)
29
29
  Vedeu.drb_start
30
30
 
31
- ### `:\_drb_status\_`
31
+ ### `:_drb_status_`
32
32
  Use the DRb server to request the status of the client application.
33
33
 
34
34
  Vedeu.trigger(:_drb_status_)
35
35
  Vedeu.drb_status
36
36
 
37
- ### `:\_drb_stop\_`
37
+ ### `:_drb_stop_`
38
38
  Use the DRb server to request the client application to stop.
39
39
 
40
40
  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
 
@@ -7,8 +7,10 @@ Note: 'name' is a Symbol unless mentioned otherwise.
7
7
  For cursor related movement events, please refer to
8
8
  {file:docs/cursors.md} Cursors.
9
9
 
10
-
11
- ### `:\_view_(up, down, left, right)\_`
10
+ ### `:_view_up_`
11
+ ### `:_view_down_`
12
+ ### `:_view_left_`
13
+ ### `:_view_right_`
12
14
 
13
15
  Please note that the name of the view is required for these events.
14
16
 
@@ -17,4 +19,4 @@ Please note that the name of the view is required for these events.
17
19
  Vedeu.trigger(:_view_right_, name)
18
20
  Vedeu.trigger(:_view_up_, name)
19
21
 
20
- Each of the `:\_view\_*` events has an alias, `:\_geometry\_*` if you prefer.
22
+ 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,23 +14,23 @@ will be still refreshed in memory but not shown.
14
14
 
15
15
  Vedeu.trigger(:_refresh_)
16
16
 
17
- ### `:\_refresh_cursor\_`
17
+ ### `:_refresh_cursor_`
18
18
  Will cause the named cursor to refresh, or the cursor of the interface
19
19
  which is currently in focus.
20
20
 
21
21
  Vedeu.trigger(:_refresh_cursor_, name)
22
22
 
23
- ### `:\_refresh_group\_`
23
+ ### `:_refresh_group_`
24
24
  Will cause all interfaces in the named group to refresh.
25
25
 
26
26
  Vedeu.trigger(:_refresh_group_, name)
27
27
 
28
- ### `:\_refresh_view\_`
28
+ ### `:_refresh_view_`
29
29
  Will cause the named view to refresh.
30
30
 
31
31
  Vedeu.trigger(:_refresh_view_, name)
32
32
 
33
- ### `:\_refresh_view_content\_`
33
+ ### `:_refresh_view_content_`
34
34
  Will cause only the content of the named view to refresh.
35
35
 
36
36
  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,7 +10,7 @@ popular here.
10
10
 
11
11
  Vedeu.trigger(:_exit_)
12
12
 
13
- ### `:\_command\_`
13
+ ### `:_command_`
14
14
  This event is used by Vedeu internally, though you can bind to it if
15
15
  you wish. It is preferred for you to bind to `:command` though.
16
16
 
@@ -30,7 +30,7 @@ API methods: (See {Vedeu::Input::Store} for more details).
30
30
 
31
31
  Vedeu.last_command
32
32
 
33
- ### `:\_editor\_`
33
+ ### `:_editor_`
34
34
  This event is called by {Vedeu::Input::Capture#read}. When
35
35
  invoked, the key will be passed to the editor for currently
36
36
  focussed view.
@@ -40,21 +40,21 @@ represented by Symbols.
40
40
 
41
41
  Vedeu.trigger(:_editor_, key)
42
42
 
43
- ### `:\_exit\_`
43
+ ### `:_exit_`
44
44
  When triggered, Vedeu will trigger a `:cleanup` event which you can
45
45
  define (to save files, etc) and attempt to exit.
46
46
 
47
47
  Vedeu.trigger(:_exit_)
48
48
  Vedeu.exit
49
49
 
50
- ### `:\_initialize\_`
50
+ ### `:_initialize_`
51
51
  Vedeu triggers this event when it is ready to enter the main loop.
52
52
  Client applications can listen for this event and perform some
53
53
  action(s), like render the first screen, interface or make a sound.
54
54
 
55
55
  Vedeu.trigger(:_initialize_)
56
56
 
57
- ### `:\_keypress\_`
57
+ ### `:_keypress_`
58
58
  This event is used by Vedeu internally, though you can bind to it if
59
59
  you wish. It is preferred for you to bind to `:key` though.
60
60
 
@@ -95,7 +95,7 @@ A list of supported keypresses can be found here:
95
95
 
96
96
  Vedeu.trigger(:_keypress_, key, optional_name)
97
97
 
98
- ### `:\_log\_`
98
+ ### `:_log_`
99
99
  When triggered with a message will cause Vedeu to log the message if
100
100
  logging is enabled in the configuration.
101
101
 
@@ -103,7 +103,7 @@ Note: 'message' is a String.
103
103
 
104
104
  Vedeu.trigger(:_log_, message)
105
105
 
106
- ### `:\_mode_switch\_`
106
+ ### `:_mode_switch_`
107
107
  When triggered, Vedeu switches between modes of the terminal. The idea
108
108
  here being that the raw mode is for single keypress actions, whilst
109
109
  fake and cooked modes allow the user to enter more elaborate commands-
data/docs/events/view.md CHANGED
@@ -4,14 +4,14 @@
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::Geometries::Geometry#maximise}
13
13
 
14
- ### `:\_movement_refresh\_`
14
+ ### `:_movement_refresh_`
15
15
  When triggered, triggers additional events which aid the updating of
16
16
  the output. Used when moving an interface/view.
17
17
 
@@ -31,13 +31,13 @@ At this time, triggering this event will:
31
31
  - Refreshes the named view. This action adds the named view to the
32
32
  terminal (or output); in the new position.
33
33
 
34
- ### `:\_resize\_`
34
+ ### `:_resize_`
35
35
  When triggered will cause Vedeu to trigger the `:_clear_` and
36
36
  `:_refresh_` events. Please see those events for their behaviour.
37
37
 
38
38
  Vedeu.trigger(:_resize_)
39
39
 
40
- ### `:\_unmaximise\_`
40
+ ### `:_unmaximise_`
41
41
  Unmaximising an interface.
42
42
 
43
43
  Vedeu.trigger(:_unmaximise_, name)
@@ -4,81 +4,59 @@
4
4
 
5
5
  Note: 'name' is a Symbol unless mentioned otherwise.
6
6
 
7
- ### `:\_clear\_`
7
+ ### `:_clear_`
8
8
  See {Vedeu::Buffers::Terminal#clear}
9
9
 
10
- ### `:\_clear_group\_`
10
+ ### `:_clear_group_`
11
11
  Clears the spaces occupied by the interfaces belonging to the named
12
12
  group.
13
13
 
14
14
  Vedeu.trigger(:_clear_group_, name)
15
15
  Vedeu.clear_by_group(name)
16
16
 
17
- ### `:\_clear_view\_`
17
+ ### `:_clear_view_`
18
18
  Clears the named view/interface area.
19
19
 
20
20
  Vedeu.trigger(:_clear_view_, name)
21
21
  Vedeu.clear_by_name(name)
22
22
 
23
- ### `:\_clear_view_content\_`
23
+ ### `:_clear_view_content_`
24
24
  Clears only the content of the named view/interface area.
25
25
 
26
26
  Vedeu.trigger(:_clear_view_content_, name)
27
27
  Vedeu.clear_content_by_name(name)
28
28
 
29
- ### `:\_hide_cursor\_`
30
- Hide the cursor of the named interface or when a name is not given,
31
- the interface currently in focus.
32
-
33
- Vedeu.trigger(:_hide_cursor_, name)
34
- Vedeu.trigger(:_cursor_hide_, name)
35
- Vedeu.hide_cursor(name)
36
-
37
- ### `:\_hide_group\_`
29
+ ### `:_hide_group_`
38
30
  Hiding a group of interfaces.
39
31
 
40
32
  Vedeu.trigger(:_hide_group_, name)
41
33
  Vedeu.hide_group(name)
42
34
 
43
- ### `:\_hide_interface\_`
35
+ ### `:_hide_interface_`
44
36
  Hide an interface by name.
45
37
 
46
38
  Vedeu.trigger(:_hide_interface_, name)
47
39
  Vedeu.hide_interface(name)
48
40
 
49
- ### `:\_show_cursor\_`
50
- Show the cursor of the named interface or when a name is not given,
51
- the interface currently in focus.
52
-
53
- Vedeu.trigger(:_show_cursor_, name)
54
- Vedeu.trigger(:_cursor_show_, name)
55
- Vedeu.show_cursor(name)
56
-
57
- ### `:\_show_group\_`
41
+ ### `:_show_group_`
58
42
  Showing a group of interfaces.
59
43
 
60
44
  Vedeu.trigger(:_show_group_, name)
61
45
  Vedeu.show_group(name)
62
46
 
63
- ### `:\_show_interface\_`
47
+ ### `:_show_interface_`
64
48
  Show an interface by name.
65
49
 
66
50
  Vedeu.trigger(:_show_interface_, name)
67
51
  Vedeu.show_interface(name)
68
52
 
69
- ### `:\_toggle_cursor\_`
70
- Toggling a cursor.
71
-
72
- Vedeu.trigger(:_toggle_cursor_, name)
73
- Vedeu.toggle_cursor(name)
74
-
75
- ### `:\_toggle_group\_`
53
+ ### `:_toggle_group_`
76
54
  Toggling a group of interfaces.
77
55
 
78
56
  Vedeu.trigger(:_toggle_group_, name)
79
57
  Vedeu.toggle_group(name)
80
58
 
81
- ### `:\_toggle_interface\_`
59
+ ### `:_toggle_interface_`
82
60
  Toggling an interface.
83
61
 
84
62
  Vedeu.trigger(:_toggle_interface_, name)
data/docs/input.md CHANGED
@@ -90,7 +90,7 @@ immediately.
90
90
 
91
91
  During the lifecycle of a Vedeu client application it may be necessary
92
92
  to switch between the different modes offered. This is handled by
93
- triggering the `:\_mode_switch\_` event. By default, this cycles
93
+ triggering the `:_mode_switch_` event. By default, this cycles
94
94
  through the available modes. When an optional but valid target mode is
95
95
  given, that mode will be activated instead.
96
96
 
@@ -13,13 +13,13 @@ module Vedeu
13
13
  private
14
14
 
15
15
  # @return [String]
16
- def named_codes
17
- Vedeu::EscapeSequences::Esc.background_codes[colour]
16
+ def prefix
17
+ "\e[48;".freeze
18
18
  end
19
19
 
20
20
  # @return [String]
21
- def numbered_prefix
22
- "\e[48;5;".freeze
21
+ def named_codes
22
+ Vedeu::EscapeSequences::Esc.background_codes[colour]
23
23
  end
24
24
 
25
25
  # @return [Vedeu::Colours::Backgrounds]
@@ -27,11 +27,6 @@ module Vedeu
27
27
  Vedeu.background_colours
28
28
  end
29
29
 
30
- # @return [String]
31
- def rgb_prefix
32
- "\e[48;2;%s;%s;%sm".freeze
33
- end
34
-
35
30
  end # Background
36
31
 
37
32
  end # Colours
@@ -13,13 +13,13 @@ module Vedeu
13
13
  private
14
14
 
15
15
  # @return [String]
16
- def named_codes
17
- Vedeu::EscapeSequences::Esc.foreground_codes[colour]
16
+ def prefix
17
+ "\e[38;".freeze
18
18
  end
19
19
 
20
20
  # @return [String]
21
- def numbered_prefix
22
- "\e[38;5;".freeze
21
+ def named_codes
22
+ Vedeu::EscapeSequences::Esc.foreground_codes[colour]
23
23
  end
24
24
 
25
25
  # @return [Vedeu::Colours::Foregrounds]
@@ -27,11 +27,6 @@ module Vedeu
27
27
  Vedeu.foreground_colours
28
28
  end
29
29
 
30
- # @return [String]
31
- def rgb_prefix
32
- "\e[38;2;%s;%s;%sm".freeze
33
- end
34
-
35
30
  end # Foreground
36
31
 
37
32
  end # Colours