vedeu 0.5.13 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/bin/vedeu_drb_server +1 -0
- data/config/rubocop_enabled.yml +2 -2
- data/docs/events.md +2 -0
- data/docs/getting_started.md +1 -1
- data/examples/drb_app.rb +1 -0
- data/examples/editor_app.rb +76 -0
- data/lib/vedeu/all.rb +13 -7
- data/lib/vedeu/{bindings.rb → bindings/bindings.rb} +2 -0
- data/lib/vedeu/bindings/focus.rb +66 -0
- data/lib/vedeu/bindings/refresh.rb +77 -0
- data/lib/vedeu/bindings/system.rb +19 -88
- data/lib/vedeu/buffers/buffer.rb +8 -8
- data/lib/vedeu/configuration/api.rb +32 -11
- data/lib/vedeu/configuration/cli.rb +8 -0
- data/lib/vedeu/cursor/move.rb +1 -0
- data/lib/vedeu/distributed/templates/default_configuration.vedeu +1 -0
- data/lib/vedeu/{dsl.rb → dsl/dsl.rb} +0 -0
- data/lib/vedeu/exceptions.rb +1 -1
- data/lib/vedeu/geometry/position.rb +28 -0
- data/lib/vedeu/input/capture.rb +76 -0
- data/lib/vedeu/input/editor/all.rb +19 -0
- data/lib/vedeu/input/editor/cropper.rb +74 -0
- data/lib/vedeu/input/editor/document.rb +254 -0
- data/lib/vedeu/input/editor/documents.rb +18 -0
- data/lib/vedeu/input/editor/editor.rb +100 -0
- data/lib/vedeu/input/editor/line.rb +143 -0
- data/lib/vedeu/input/editor/lines.rb +199 -0
- data/lib/vedeu/input/editor/virtual_cursor.rb +167 -0
- data/lib/vedeu/input/input.rb +9 -93
- data/lib/vedeu/input/input_translator.rb +155 -0
- data/lib/vedeu/internal_api.rb +9 -0
- data/lib/vedeu/log/lockless_log_device.rb +1 -1
- data/lib/vedeu/models/escape.rb +7 -8
- data/lib/vedeu/output/direct.rb +59 -0
- data/lib/vedeu/output/renderers/terminal.rb +8 -0
- data/lib/vedeu/output/viewport.rb +2 -3
- data/lib/vedeu/{plugins.rb → plugins/plugins.rb} +0 -0
- data/lib/vedeu/refresh/refresh_cursor.rb +1 -0
- data/lib/vedeu/{repositories.rb → repositories/repositories.rb} +0 -0
- data/lib/vedeu/terminal/content.rb +88 -0
- data/lib/vedeu/terminal/mode.rb +79 -0
- data/lib/vedeu/{terminal.rb → terminal/terminal.rb} +9 -25
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/{bindings_test.rb → bindings/bindings_test.rb} +0 -0
- data/test/lib/vedeu/bindings/focus_test.rb +19 -0
- data/test/lib/vedeu/bindings/refresh_test.rb +19 -0
- data/test/lib/vedeu/bindings/system_test.rb +1 -6
- data/test/lib/vedeu/borders/render_border_test.rb +43 -10
- data/test/lib/vedeu/buffers/buffer_test.rb +18 -0
- data/test/lib/vedeu/buffers/virtual_buffer_test.rb +15 -0
- data/test/lib/vedeu/configuration/api_test.rb +18 -2
- data/test/lib/vedeu/configuration/cli_test.rb +5 -0
- data/test/lib/vedeu/cursor/move_test.rb +1 -1
- data/test/lib/vedeu/dsl/dsl_test.rb +8 -0
- data/test/lib/vedeu/dsl/shared_test.rb +12 -0
- data/test/lib/vedeu/{output → esc}/esc_test.rb +0 -0
- data/test/lib/vedeu/geometry/position_test.rb +56 -0
- data/test/lib/vedeu/input/capture_test.rb +63 -0
- data/test/lib/vedeu/input/editor/cropper_test.rb +82 -0
- data/test/lib/vedeu/input/editor/document_test.rb +190 -0
- data/test/lib/vedeu/input/editor/documents_test.rb +17 -0
- data/test/lib/vedeu/input/editor/editor_test.rb +170 -0
- data/test/lib/vedeu/input/editor/line_test.rb +333 -0
- data/test/lib/vedeu/input/editor/lines_test.rb +561 -0
- data/test/lib/vedeu/input/editor/virtual_cursor_test.rb +184 -0
- data/test/lib/vedeu/input/input_test.rb +20 -4
- data/test/lib/vedeu/input/input_translator_test.rb +32 -0
- data/test/lib/vedeu/internal_api_test.rb +1 -0
- data/test/lib/vedeu/models/escape_test.rb +6 -6
- data/test/lib/vedeu/models/views/view_test.rb +15 -2
- data/test/lib/vedeu/null/null_test.rb +8 -0
- data/test/lib/vedeu/output/direct_test.rb +70 -0
- data/test/lib/vedeu/{plugins_test.rb → plugins/plugins_test.rb} +0 -0
- data/test/lib/vedeu/{repositories_test.rb → repositories/repositories_test.rb} +0 -0
- data/test/lib/vedeu/terminal/content_test.rb +100 -0
- data/test/lib/vedeu/terminal/mode_test.rb +95 -0
- data/test/lib/vedeu/{terminal_test.rb → terminal/terminal_test.rb} +23 -23
- data/test/test_helper.rb +1 -0
- metadata +67 -20
- data/lib/vedeu/terminal_mode.rb +0 -59
- data/test/lib/vedeu/terminal_mode_test.rb +0 -72
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28c51799d818421857c42dfc95970d49794fa75f
|
4
|
+
data.tar.gz: dd35047e639be0064234964695a8b4f853ea4e54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae7a0e4eca0ba65eb6e285681147f9938fba540bda076c10c09a47bcd8fae0eee253508f335540bd049be3ad85885974103332012ca4c878e526669fd0337fb8
|
7
|
+
data.tar.gz: 93cb36006d06bdf9acfd10fca1c527bdfb9cbd12eb5d73ee4feae73bb51a33e49bc5fdbd8a34d13a64ef905adac9493605711ba21072f9220750d588fd953ce0
|
data/.rubocop.yml
CHANGED
@@ -96,6 +96,9 @@ Style/Next:
|
|
96
96
|
- skip_modifier_ifs
|
97
97
|
- always
|
98
98
|
|
99
|
+
Style/SpaceAroundOperators:
|
100
|
+
Enabled: false
|
101
|
+
|
99
102
|
Style/SpaceAroundEqualsInParameterDefault:
|
100
103
|
EnforcedStyle: space
|
101
104
|
|
@@ -180,3 +183,6 @@ Lint/DefEndAlignment:
|
|
180
183
|
- start_of_line
|
181
184
|
- def
|
182
185
|
|
186
|
+
Lint/Eval:
|
187
|
+
Description: 'The use of eval represents a serious security risk.'
|
188
|
+
Enabled: false
|
data/bin/vedeu_drb_server
CHANGED
data/config/rubocop_enabled.yml
CHANGED
@@ -609,7 +609,7 @@ Style/SpaceAroundEqualsInParameterDefault:
|
|
609
609
|
Style/SpaceAroundOperators:
|
610
610
|
Description: 'Use a single space around operators.'
|
611
611
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
|
612
|
-
Enabled:
|
612
|
+
Enabled: false
|
613
613
|
|
614
614
|
Style/SpaceBeforeModifierKeyword:
|
615
615
|
Description: 'Put a space before the modifier keyword.'
|
@@ -858,7 +858,7 @@ Lint/EnsureReturn:
|
|
858
858
|
|
859
859
|
Lint/Eval:
|
860
860
|
Description: 'The use of eval represents a serious security risk.'
|
861
|
-
Enabled:
|
861
|
+
Enabled: false
|
862
862
|
|
863
863
|
Lint/HandleExceptions:
|
864
864
|
Description: "Don't suppress exception."
|
data/docs/events.md
CHANGED
data/docs/getting_started.md
CHANGED
data/examples/drb_app.rb
CHANGED
@@ -0,0 +1,76 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
lib_dir = File.dirname(__FILE__) + '/../lib'
|
4
|
+
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
5
|
+
|
6
|
+
require 'vedeu'
|
7
|
+
|
8
|
+
# An example application to demonstrate colours, cursor and interface movement,
|
9
|
+
# maximising/unmaximising of interfaces and toggling of cursors and interfaces.
|
10
|
+
#
|
11
|
+
# If you have cloned this repository from GitHub, you can run this example:
|
12
|
+
#
|
13
|
+
# ./examples/material_colours_app.rb
|
14
|
+
#
|
15
|
+
# Running this application once, and immediately exiting produces the diagram
|
16
|
+
# at `./examples/material_colours_app_20150721.svg`. Hopefully this will help
|
17
|
+
# you to understand how parts of Vedeu work together. Questions are always
|
18
|
+
# welcome at `https://github.com/gavinlaking/vedeu/issues`
|
19
|
+
#
|
20
|
+
class VedeuEditorApp
|
21
|
+
|
22
|
+
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
23
|
+
|
24
|
+
# Be aware that running an application with debugging enabled will affect
|
25
|
+
# performance.
|
26
|
+
Vedeu.configure do
|
27
|
+
# debug!
|
28
|
+
fake!
|
29
|
+
log '/tmp/vedeu_editor_app.log'
|
30
|
+
# renderers Vedeu::Renderers::File.new
|
31
|
+
end
|
32
|
+
|
33
|
+
Vedeu.interface 'main_interface' do
|
34
|
+
border 'main_interface' do
|
35
|
+
colour foreground: '#ffffff', background: :default
|
36
|
+
title 'Editor'
|
37
|
+
caption('Ctrl+C = Quit')
|
38
|
+
end
|
39
|
+
colour foreground: '#ffffff', background: :default
|
40
|
+
cursor!
|
41
|
+
geometry 'main_interface' do
|
42
|
+
x columns(1)
|
43
|
+
xn columns(11)
|
44
|
+
y rows(1)
|
45
|
+
yn rows(1) + 4
|
46
|
+
end
|
47
|
+
zindex 1
|
48
|
+
end
|
49
|
+
|
50
|
+
Vedeu.keymap('_global_') do
|
51
|
+
key(:up) { Vedeu.trigger(:_cursor_up_) }
|
52
|
+
key(:right) { Vedeu.trigger(:_cursor_right_) }
|
53
|
+
key(:down) { Vedeu.trigger(:_cursor_down_) }
|
54
|
+
key(:left) { Vedeu.trigger(:_cursor_left_) }
|
55
|
+
|
56
|
+
key('q') { Vedeu.trigger(:_exit_) }
|
57
|
+
key(:escape) { Vedeu.trigger(:_mode_switch_) }
|
58
|
+
key(:shift_tab) { Vedeu.trigger(:_focus_prev_) }
|
59
|
+
key(:tab) { Vedeu.trigger(:_focus_next_) }
|
60
|
+
end
|
61
|
+
|
62
|
+
Vedeu.renders do
|
63
|
+
view 'main_interface' do
|
64
|
+
line { line '' }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
Vedeu.focus_by_name 'main_interface'
|
69
|
+
|
70
|
+
def self.start(argv = ARGV)
|
71
|
+
Vedeu::Launcher.execute!(argv)
|
72
|
+
end
|
73
|
+
|
74
|
+
end # VedeuEditorApp
|
75
|
+
|
76
|
+
VedeuEditorApp.start(ARGV)
|
data/lib/vedeu/all.rb
CHANGED
@@ -9,14 +9,16 @@ require 'vedeu/log/debug'
|
|
9
9
|
require 'vedeu/log/timer'
|
10
10
|
require 'vedeu/runtime/traps'
|
11
11
|
require 'vedeu/common'
|
12
|
-
require 'vedeu/terminal_mode'
|
13
12
|
require 'vedeu/runtime/router'
|
14
13
|
|
15
14
|
require 'vedeu/configuration/cli'
|
16
15
|
require 'vedeu/configuration/api'
|
17
16
|
require 'vedeu/configuration/configuration'
|
18
17
|
|
19
|
-
require 'vedeu/terminal'
|
18
|
+
require 'vedeu/terminal/mode'
|
19
|
+
require 'vedeu/terminal/terminal'
|
20
|
+
require 'vedeu/terminal/content'
|
21
|
+
|
20
22
|
require 'vedeu/runtime/main_loop'
|
21
23
|
require 'vedeu/runtime/flags'
|
22
24
|
require 'vedeu/runtime/application'
|
@@ -26,7 +28,7 @@ require 'vedeu/models/toggleable'
|
|
26
28
|
require 'vedeu/repositories/collection'
|
27
29
|
require 'vedeu/input/keys'
|
28
30
|
require 'vedeu/events/event_collection'
|
29
|
-
require 'vedeu/repositories'
|
31
|
+
require 'vedeu/repositories/repositories'
|
30
32
|
|
31
33
|
require 'vedeu/repositories/model'
|
32
34
|
require 'vedeu/repositories/store'
|
@@ -123,7 +125,7 @@ require 'vedeu/distributed/client'
|
|
123
125
|
require 'vedeu/distributed/subprocess'
|
124
126
|
require 'vedeu/distributed/test_application'
|
125
127
|
|
126
|
-
require 'vedeu/dsl'
|
128
|
+
require 'vedeu/dsl/dsl'
|
127
129
|
require 'vedeu/dsl/shared'
|
128
130
|
require 'vedeu/dsl/use'
|
129
131
|
require 'vedeu/dsl/presentation'
|
@@ -139,16 +141,19 @@ require 'vedeu/dsl/menu'
|
|
139
141
|
require 'vedeu/dsl/stream'
|
140
142
|
require 'vedeu/dsl/view'
|
141
143
|
|
144
|
+
require 'vedeu/input/input_translator'
|
142
145
|
require 'vedeu/input/mapper'
|
143
146
|
require 'vedeu/input/key'
|
144
147
|
require 'vedeu/input/input'
|
145
148
|
require 'vedeu/input/keymap'
|
146
149
|
require 'vedeu/input/keymaps'
|
150
|
+
require 'vedeu/input/editor/all'
|
147
151
|
|
148
152
|
require 'vedeu/borders/render_border'
|
149
153
|
require 'vedeu/borders/border'
|
150
154
|
require 'vedeu/borders/borders'
|
151
155
|
|
156
|
+
require 'vedeu/output/direct'
|
152
157
|
require 'vedeu/output/clear/named_group'
|
153
158
|
require 'vedeu/output/clear/named_interface'
|
154
159
|
require 'vedeu/output/presentation'
|
@@ -168,10 +173,11 @@ require 'vedeu/bindings/application'
|
|
168
173
|
require 'vedeu/bindings/drb'
|
169
174
|
require 'vedeu/bindings/menus'
|
170
175
|
require 'vedeu/bindings/movement'
|
176
|
+
require 'vedeu/bindings/focus'
|
177
|
+
require 'vedeu/bindings/refresh'
|
171
178
|
require 'vedeu/bindings/system'
|
172
179
|
require 'vedeu/bindings/visibility'
|
180
|
+
require 'vedeu/bindings/bindings'
|
173
181
|
|
174
|
-
require 'vedeu/
|
175
|
-
|
176
|
-
require 'vedeu/plugins'
|
182
|
+
require 'vedeu/plugins/plugins'
|
177
183
|
require 'vedeu/plugins/plugin'
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
module Bindings
|
4
|
+
|
5
|
+
# Creates system events which when called provide a variety of core
|
6
|
+
# functions and behaviours. They are soft-namespaced using underscores.
|
7
|
+
#
|
8
|
+
# @note
|
9
|
+
# Unbinding any of these events is likely to cause problems, so I would
|
10
|
+
# advise leaving them alone. A safe rule: when the name starts with an
|
11
|
+
# underscore, it's probably used by Vedeu internally.
|
12
|
+
#
|
13
|
+
# :nocov:
|
14
|
+
module Focus
|
15
|
+
|
16
|
+
extend self
|
17
|
+
|
18
|
+
# Setup events relating to running Vedeu. This method is called by Vedeu.
|
19
|
+
#
|
20
|
+
# @return [TrueClass]
|
21
|
+
def setup!
|
22
|
+
focus_by_name!
|
23
|
+
focus_next!
|
24
|
+
focus_prev!
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
# When triggered with an interface name will focus that interface and
|
30
|
+
# restore the cursor position and visibility.
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
# Vedeu.trigger(:_focus_by_name_, name)
|
34
|
+
#
|
35
|
+
# @return [TrueClass]
|
36
|
+
def focus_by_name!
|
37
|
+
Vedeu.bind(:_focus_by_name_) { |name| Vedeu.focus_by_name(name) }
|
38
|
+
end
|
39
|
+
|
40
|
+
# When triggered will focus the next interface and restore the cursor
|
41
|
+
# position and visibility.
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
# Vedeu.trigger(:_focus_next_)
|
45
|
+
#
|
46
|
+
# @return [TrueClass]
|
47
|
+
def focus_next!
|
48
|
+
Vedeu.bind(:_focus_next_) { Vedeu.focus_next }
|
49
|
+
end
|
50
|
+
|
51
|
+
# When triggered will focus the previous interface and restore the cursor
|
52
|
+
# position and visibility.
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
# Vedeu.trigger(:_focus_prev_)
|
56
|
+
#
|
57
|
+
# @return [TrueClass]
|
58
|
+
def focus_prev!
|
59
|
+
Vedeu.bind(:_focus_prev_) { Vedeu.focus_previous }
|
60
|
+
end
|
61
|
+
|
62
|
+
end # Focus
|
63
|
+
|
64
|
+
end # Bindings
|
65
|
+
|
66
|
+
end # Vedeu
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
module Bindings
|
4
|
+
|
5
|
+
# Creates system events which when called provide a variety of core
|
6
|
+
# functions and behaviours. They are soft-namespaced using underscores.
|
7
|
+
#
|
8
|
+
# @note
|
9
|
+
# Unbinding any of these events is likely to cause problems, so I would
|
10
|
+
# advise leaving them alone. A safe rule: when the name starts with an
|
11
|
+
# underscore, it's probably used by Vedeu internally.
|
12
|
+
#
|
13
|
+
# :nocov:
|
14
|
+
module Refresh
|
15
|
+
|
16
|
+
extend self
|
17
|
+
|
18
|
+
# Setup events relating to running Vedeu. This method is called by Vedeu.
|
19
|
+
#
|
20
|
+
# @return [TrueClass]
|
21
|
+
def setup!
|
22
|
+
refresh!
|
23
|
+
refresh_cursor!
|
24
|
+
refresh_group!
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
# Refreshes all registered interfaces or the named interface.
|
30
|
+
#
|
31
|
+
# @note
|
32
|
+
# The interfaces will be refreshed in z-index order, meaning that
|
33
|
+
# interfaces with a lower z-index will be drawn first. This means
|
34
|
+
# overlapping interfaces will be drawn as specified.
|
35
|
+
# Hidden interfaces will be still refreshed in memory but not shown.
|
36
|
+
#
|
37
|
+
# @example
|
38
|
+
# Vedeu.trigger(:_refresh_)
|
39
|
+
# Vedeu.trigger(:_refresh_, name)
|
40
|
+
#
|
41
|
+
# @return [TrueClass]
|
42
|
+
def refresh!
|
43
|
+
Vedeu.bind(:_refresh_) do |name|
|
44
|
+
name ? Vedeu::RefreshBuffer.by_name(name) : Vedeu::Refresh.all
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Will cause the named cursor to refresh, or the cursor of the interface
|
49
|
+
# which is currently in focus.
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
# Vedeu.trigger(:_refresh_cursor_, name)
|
53
|
+
#
|
54
|
+
# @return [TrueClass]
|
55
|
+
def refresh_cursor!
|
56
|
+
Vedeu.bind(:_refresh_cursor_) do |name|
|
57
|
+
Vedeu::RefreshCursor.by_name(name)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Will cause all interfaces in the named group to refresh.
|
62
|
+
#
|
63
|
+
# @example
|
64
|
+
# Vedeu.trigger(:_refresh_group_, name)
|
65
|
+
#
|
66
|
+
# @return [TrueClass]
|
67
|
+
def refresh_group!
|
68
|
+
Vedeu.bind(:_refresh_group_) do |name|
|
69
|
+
Vedeu::RefreshGroup.by_name(name)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end # Refresh
|
74
|
+
|
75
|
+
end # Bindings
|
76
|
+
|
77
|
+
end # Vedeu
|
@@ -22,18 +22,13 @@ module Vedeu
|
|
22
22
|
cleanup!
|
23
23
|
clear!
|
24
24
|
command!
|
25
|
+
editor!
|
25
26
|
exit!
|
26
|
-
focus_next!
|
27
|
-
focus_prev!
|
28
|
-
focus_by_name!
|
29
27
|
initialize!
|
30
28
|
keypress!
|
31
29
|
log!
|
32
30
|
maximise!
|
33
31
|
mode_switch!
|
34
|
-
refresh!
|
35
|
-
refresh_cursor!
|
36
|
-
refresh_group!
|
37
32
|
resize!
|
38
33
|
unmaximise!
|
39
34
|
end
|
@@ -87,49 +82,29 @@ module Vedeu
|
|
87
82
|
Vedeu.bind(:_command_) { |command| Vedeu.trigger(:command, command) }
|
88
83
|
end
|
89
84
|
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
# @example
|
94
|
-
# Vedeu.trigger(:_exit_)
|
95
|
-
# Vedeu.exit
|
96
|
-
#
|
97
|
-
# @return [TrueClass]
|
98
|
-
def exit!
|
99
|
-
Vedeu.bind(:_exit_) { Vedeu::Application.stop }
|
100
|
-
end
|
101
|
-
|
102
|
-
# When triggered with an interface name will focus that interface and
|
103
|
-
# restore the cursor position and visibility.
|
85
|
+
# This event is called by {Vedeu::Input#capture}. When invoked, the
|
86
|
+
# key will be passed to the editor for currently focussed view.
|
104
87
|
#
|
105
88
|
# @example
|
106
|
-
# Vedeu.trigger(:
|
89
|
+
# Vedeu.trigger(:_editor_, key)
|
107
90
|
#
|
108
91
|
# @return [TrueClass]
|
109
|
-
def
|
110
|
-
Vedeu.bind(:
|
111
|
-
|
112
|
-
|
113
|
-
# When triggered will focus the next interface and restore the cursor
|
114
|
-
# position and visibility.
|
115
|
-
#
|
116
|
-
# @example
|
117
|
-
# Vedeu.trigger(:_focus_next_)
|
118
|
-
#
|
119
|
-
# @return [TrueClass]
|
120
|
-
def focus_next!
|
121
|
-
Vedeu.bind(:_focus_next_) { Vedeu.focus_next }
|
92
|
+
def editor!
|
93
|
+
Vedeu.bind(:_editor_) do |key|
|
94
|
+
Vedeu::Editor::Editor.keypress(name: Vedeu.focus, input: key)
|
95
|
+
end
|
122
96
|
end
|
123
97
|
|
124
|
-
# When triggered will
|
125
|
-
#
|
98
|
+
# When triggered, Vedeu will trigger a `:cleanup` event which you can
|
99
|
+
# define (to save files, etc) and attempt to exit.
|
126
100
|
#
|
127
101
|
# @example
|
128
|
-
# Vedeu.trigger(:
|
102
|
+
# Vedeu.trigger(:_exit_)
|
103
|
+
# Vedeu.exit
|
129
104
|
#
|
130
105
|
# @return [TrueClass]
|
131
|
-
def
|
132
|
-
Vedeu.bind(:
|
106
|
+
def exit!
|
107
|
+
Vedeu.bind(:_exit_) { Vedeu::Application.stop }
|
133
108
|
end
|
134
109
|
|
135
110
|
# Vedeu triggers this event when it is ready to enter the main loop.
|
@@ -183,11 +158,11 @@ module Vedeu
|
|
183
158
|
end
|
184
159
|
end
|
185
160
|
|
186
|
-
# When triggered (after the user presses `escape`), Vedeu
|
187
|
-
#
|
188
|
-
# that the raw mode is for single keypress actions, whilst cooked
|
189
|
-
#
|
190
|
-
# arguments.
|
161
|
+
# When triggered (by default, after the user presses `escape`), Vedeu
|
162
|
+
# switches between modes of the terminal. The idea here being
|
163
|
+
# that the raw mode is for single keypress actions, whilst fake and cooked
|
164
|
+
# modes allow the user to enter more elaborate commands- such as commands
|
165
|
+
# with arguments.
|
191
166
|
#
|
192
167
|
# @example
|
193
168
|
# Vedeu.trigger(:_mode_switch_)
|
@@ -197,50 +172,6 @@ module Vedeu
|
|
197
172
|
Vedeu.bind(:_mode_switch_) { fail Vedeu::ModeSwitch }
|
198
173
|
end
|
199
174
|
|
200
|
-
# Refreshes all registered interfaces or the named interface.
|
201
|
-
#
|
202
|
-
# @note
|
203
|
-
# The interfaces will be refreshed in z-index order, meaning that
|
204
|
-
# interfaces with a lower z-index will be drawn first. This means
|
205
|
-
# overlapping interfaces will be drawn as specified.
|
206
|
-
# Hidden interfaces will be still refreshed in memory but not shown.
|
207
|
-
#
|
208
|
-
# @example
|
209
|
-
# Vedeu.trigger(:_refresh_)
|
210
|
-
# Vedeu.trigger(:_refresh_, name)
|
211
|
-
#
|
212
|
-
# @return [TrueClass]
|
213
|
-
def refresh!
|
214
|
-
Vedeu.bind(:_refresh_) do |name|
|
215
|
-
name ? Vedeu::RefreshBuffer.by_name(name) : Vedeu::Refresh.all
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
# Will cause the named cursor to refresh, or the cursor of the interface
|
220
|
-
# which is currently in focus.
|
221
|
-
#
|
222
|
-
# @example
|
223
|
-
# Vedeu.trigger(:_refresh_cursor_, name)
|
224
|
-
#
|
225
|
-
# @return [TrueClass]
|
226
|
-
def refresh_cursor!
|
227
|
-
Vedeu.bind(:_refresh_cursor_) do |name|
|
228
|
-
Vedeu::RefreshCursor.by_name(name)
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
# Will cause all interfaces in the named group to refresh.
|
233
|
-
#
|
234
|
-
# @example
|
235
|
-
# Vedeu.trigger(:_refresh_group_, name)
|
236
|
-
#
|
237
|
-
# @return [TrueClass]
|
238
|
-
def refresh_group!
|
239
|
-
Vedeu.bind(:_refresh_group_) do |name|
|
240
|
-
Vedeu::RefreshGroup.by_name(name)
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
175
|
# When triggered will cause Vedeu to trigger the `:_clear_` and
|
245
176
|
# `:_refresh_` events. Please see those events for their behaviour.
|
246
177
|
#
|