vedeu 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/docs/events.md +0 -12
- data/examples/configuration_app.rb +1 -1
- data/lib/vedeu/all.rb +0 -1
- data/lib/vedeu/bindings.rb +18 -3
- data/lib/vedeu/buffers/display_buffer.rb +0 -22
- data/lib/vedeu/configuration/api.rb +8 -44
- data/lib/vedeu/configuration/cli.rb +6 -36
- data/lib/vedeu/configuration/configuration.rb +0 -4
- data/lib/vedeu/distributed/server.rb +4 -10
- data/lib/vedeu/dsl/components/keymap.rb +3 -5
- data/lib/vedeu/input/keymap.rb +22 -45
- data/lib/vedeu/main_loop.rb +2 -0
- data/lib/vedeu/models/focus.rb +1 -1
- data/lib/vedeu/models/geometry.rb +2 -2
- data/lib/vedeu/models/view/char.rb +1 -1
- data/lib/vedeu/models/view/composition.rb +1 -1
- data/lib/vedeu/models/view/interface.rb +4 -2
- data/lib/vedeu/models/view/line.rb +1 -2
- data/lib/vedeu/models/view/stream.rb +1 -1
- data/lib/vedeu/output/all.rb +8 -0
- data/lib/vedeu/{presentation → output}/background.rb +0 -0
- data/lib/vedeu/{presentation → output}/colour.rb +0 -0
- data/lib/vedeu/{presentation → output}/foreground.rb +1 -1
- data/lib/vedeu/output/html_renderer.rb +13 -30
- data/lib/vedeu/{presentation → output}/presentation.rb +0 -0
- data/lib/vedeu/{presentation → output}/style.rb +0 -0
- data/lib/vedeu/output/templates/html_renderer.vedeu +24 -0
- data/lib/vedeu/{presentation → output}/translator.rb +0 -0
- data/lib/vedeu/support/log.rb +1 -0
- data/test/integration/dsl/compositions_test.rb +0 -8
- data/test/integration/dsl/interfaces_test.rb +0 -68
- data/test/integration/dsl/keymaps_test.rb +0 -12
- data/test/integration/dsl/lines_test.rb +0 -42
- data/test/integration/dsl/streams_test.rb +0 -26
- data/test/integration/dsl/views_test.rb +0 -18
- data/test/lib/vedeu/api_test.rb +0 -97
- data/test/lib/vedeu/configuration/api_test.rb +3 -14
- data/test/lib/vedeu/configuration/cli_test.rb +0 -14
- data/test/lib/vedeu/cursor/cursor_test.rb +0 -2
- data/test/lib/vedeu/distributed/client_test.rb +0 -2
- data/test/lib/vedeu/distributed/test_application_test.rb +0 -1
- data/test/lib/vedeu/dsl/components/keymap_test.rb +1 -7
- data/test/lib/vedeu/dsl/components/menu_test.rb +0 -48
- data/test/lib/vedeu/dsl/interface_test.rb +1 -263
- data/test/lib/vedeu/dsl/shared/text_test.rb +0 -6
- data/test/lib/vedeu/dsl/stream_test.rb +0 -2
- data/test/lib/vedeu/events/event_test.rb +0 -1
- data/test/lib/vedeu/input/keymap_test.rb +8 -2
- data/test/lib/vedeu/input/mapper_test.rb +2 -2
- data/test/lib/vedeu/launcher_test.rb +0 -12
- data/test/lib/vedeu/main_loop_test.rb +0 -17
- data/test/lib/vedeu/models/focus_test.rb +59 -19
- data/test/lib/vedeu/models/geometry_test.rb +20 -26
- data/test/lib/vedeu/models/view/interface_test.rb +0 -27
- data/test/lib/vedeu/models/view/stream_test.rb +0 -1
- data/test/lib/vedeu/{presentation → output}/background_test.rb +0 -0
- data/test/lib/vedeu/{presentation → output}/colour_test.rb +0 -0
- data/test/lib/vedeu/output/compositor_test.rb +0 -5
- data/test/lib/vedeu/{presentation → output}/foreground_test.rb +0 -0
- data/test/lib/vedeu/output/html_renderer_test.rb +1 -0
- data/test/lib/vedeu/{presentation → output}/presentation_test.rb +0 -0
- data/test/lib/vedeu/{presentation → output}/style_test.rb +0 -0
- data/test/lib/vedeu/{presentation → output}/translator_test.rb +0 -0
- data/test/lib/vedeu/output/writer_test.rb +8 -21
- data/test/lib/vedeu/repositories/repository_test.rb +0 -24
- data/test/lib/vedeu/support/refresh_test.rb +0 -10
- data/test/support/helpers/model_test_class.rb +1 -1
- data/vedeu.gemspec +1 -1
- metadata +22 -22
- data/lib/vedeu/presentation/all.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50414317727dc7045eeb48bcc676bf11fd67a06b
|
4
|
+
data.tar.gz: c4d967105b00a59ddda739d06373b9a63653e3f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02424b6a19fb5f4d88ea39e7502cf47f2b56a2401c84504f6da103fd358109665060a4420f24700bd24580c7656c8b2646ceb759ff4d4ab82c2f03bccca19366
|
7
|
+
data.tar.gz: c5eac73a0ad542d6178a6fb8a3998b1a4d6404770d2b320c06e2e173cc53768a2ef710f8dd75e700058be4f4a427df604a9b659293389e63749bf522fca4f624
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.1
|
data/docs/events.md
CHANGED
@@ -11,18 +11,6 @@ class SomeClassInYourApplication
|
|
11
11
|
# ...
|
12
12
|
```
|
13
13
|
|
14
|
-
## System Events
|
15
|
-
|
16
|
-
System events generally control the internal state of Vedeu with respects to your application. They are soft-namespaced using underscores.
|
17
|
-
|
18
|
-
### `:_refresh_group_(group_name)_`
|
19
|
-
|
20
|
-
Will refresh all interfaces belonging to this group. E.g. `_refresh_group_home_` will refresh all interfaces with the group of `home`.
|
21
|
-
|
22
|
-
### `:_refresh_(interface_name)_`
|
23
|
-
|
24
|
-
Will refresh the interface with this name. E.g. `_refresh_widget_` will refresh the interface `widget`.
|
25
|
-
|
26
14
|
|
27
15
|
##### Notes:
|
28
16
|
|
data/lib/vedeu/all.rb
CHANGED
data/lib/vedeu/bindings.rb
CHANGED
@@ -9,7 +9,7 @@ module Vedeu
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# Creates system events which when called provide a variety of core functions
|
12
|
-
# and behaviours.
|
12
|
+
# and behaviours. They are soft-namespaced using underscores.
|
13
13
|
#
|
14
14
|
# @note
|
15
15
|
# Unbinding any of these events is likely to cause problems, so I would
|
@@ -219,8 +219,23 @@ module Vedeu
|
|
219
219
|
# starting at the current item to the last item.
|
220
220
|
Vedeu.bind(:_menu_view_) { |name| Vedeu.menus.find(name).view }
|
221
221
|
|
222
|
-
# Triggering this event will cause all interfaces to refresh
|
223
|
-
|
222
|
+
# Triggering this event will cause all interfaces to refresh, or the named
|
223
|
+
# interface if one is given.
|
224
|
+
Vedeu.bind(:_refresh_) do |name|
|
225
|
+
if name
|
226
|
+
Vedeu::Refresh.by_name(name)
|
227
|
+
|
228
|
+
else
|
229
|
+
Vedeu::Refresh.all
|
230
|
+
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
# Triggering this event will cause all interfaces in the named group to
|
235
|
+
# refresh.
|
236
|
+
Vedeu.bind(:_refresh_group_) do |name|
|
237
|
+
Vedeu::Refresh.by_group(name)
|
238
|
+
end
|
224
239
|
|
225
240
|
end # Bindings
|
226
241
|
# :nocov:
|
@@ -55,28 +55,6 @@ module Vedeu
|
|
55
55
|
self
|
56
56
|
end
|
57
57
|
|
58
|
-
# Registers refresh events for the interface unless already registered.
|
59
|
-
#
|
60
|
-
# @return [Interface]
|
61
|
-
def store_refresh_events
|
62
|
-
options = { delay: delay }
|
63
|
-
event = "_refresh_#{name}_".to_sym
|
64
|
-
|
65
|
-
unless Vedeu.events.registered?(event)
|
66
|
-
Vedeu.bind(event, options) { Vedeu::Refresh.by_name(name) }
|
67
|
-
end
|
68
|
-
|
69
|
-
unless group.nil? || group.empty?
|
70
|
-
event = "_refresh_group_#{group}_".to_sym
|
71
|
-
|
72
|
-
unless Vedeu.events.registered?(event)
|
73
|
-
Vedeu.bind(event, options) { Vedeu::Refresh.by_group(group) }
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
self
|
78
|
-
end
|
79
|
-
|
80
58
|
# Registers interface name in focus list unless already registered.
|
81
59
|
#
|
82
60
|
# @return [Interface]
|
@@ -39,14 +39,12 @@ module Vedeu
|
|
39
39
|
#
|
40
40
|
# @return [Hash]
|
41
41
|
def configuration
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
})
|
46
|
-
|
47
|
-
else
|
48
|
-
options
|
42
|
+
options.merge!({
|
43
|
+
system_keys: Configuration.default_system_keys.merge(system_keys)
|
44
|
+
}) if system_keys.any?
|
49
45
|
|
46
|
+
options.each do |option, value|
|
47
|
+
Vedeu.log(type: :config, message: "API #{option.to_s}: #{value.to_s}")
|
50
48
|
end
|
51
49
|
end
|
52
50
|
|
@@ -65,8 +63,6 @@ module Vedeu
|
|
65
63
|
# @param value [Boolean]
|
66
64
|
# @return [Boolean]
|
67
65
|
def interactive!(value = true)
|
68
|
-
Vedeu.log(type: :info, message: "Configuration::API interactive: #{value}")
|
69
|
-
|
70
66
|
options[:interactive] = value
|
71
67
|
end
|
72
68
|
alias_method :interactive, :interactive!
|
@@ -82,8 +78,6 @@ module Vedeu
|
|
82
78
|
# @param value [Boolean]
|
83
79
|
# @return [Boolean]
|
84
80
|
def standalone!(value = true)
|
85
|
-
Vedeu.log(type: :info, message: "Configuration::API interactive: #{!value}")
|
86
|
-
|
87
81
|
options[:interactive] = !value
|
88
82
|
end
|
89
83
|
alias_method :standalone, :standalone!
|
@@ -100,8 +94,6 @@ module Vedeu
|
|
100
94
|
# @param value [Boolean]
|
101
95
|
# @return [Boolean]
|
102
96
|
def run_once!(value = true)
|
103
|
-
Vedeu.log(type: :info, message: "Configuration::API once: #{value}")
|
104
|
-
|
105
97
|
options[:once] = value
|
106
98
|
end
|
107
99
|
alias_method :run_once, :run_once!
|
@@ -116,8 +108,6 @@ module Vedeu
|
|
116
108
|
# @param value [Boolean]
|
117
109
|
# @return [Boolean]
|
118
110
|
def drb!(value = true)
|
119
|
-
Vedeu.log(type: :info, message: "Configuration::API drb: #{value}")
|
120
|
-
|
121
111
|
options[:drb] = value
|
122
112
|
end
|
123
113
|
alias_method :drb, :drb!
|
@@ -183,8 +173,6 @@ module Vedeu
|
|
183
173
|
#
|
184
174
|
# @return [Boolean]
|
185
175
|
def cooked!
|
186
|
-
Vedeu.log(type: :info, message: "Configuration::API terminal_mode: :cooked")
|
187
|
-
|
188
176
|
options[:terminal_mode] = :cooked
|
189
177
|
end
|
190
178
|
alias_method :cooked, :cooked!
|
@@ -198,8 +186,6 @@ module Vedeu
|
|
198
186
|
#
|
199
187
|
# @return [Boolean]
|
200
188
|
def raw!
|
201
|
-
Vedeu.log(type: :info, message: "Configuration::API terminal_mode: :raw")
|
202
|
-
|
203
189
|
options[:terminal_mode] = :raw
|
204
190
|
end
|
205
191
|
alias_method :raw, :raw!
|
@@ -222,13 +208,9 @@ module Vedeu
|
|
222
208
|
# @return [Boolean]
|
223
209
|
def debug!(value = true)
|
224
210
|
if options.key?(:trace) && options[:trace] != false
|
225
|
-
Vedeu.log(type: :info, message: "Configuration::API debug: true")
|
226
|
-
|
227
211
|
options[:debug] = true
|
228
212
|
|
229
213
|
else
|
230
|
-
Vedeu.log(type: :info, message: "Configuration::API debug: #{value}")
|
231
|
-
|
232
214
|
options[:debug] = value
|
233
215
|
|
234
216
|
end
|
@@ -252,9 +234,6 @@ module Vedeu
|
|
252
234
|
# @return [Boolean]
|
253
235
|
def trace!(value = true)
|
254
236
|
options[:debug] = true if value === true
|
255
|
-
|
256
|
-
Vedeu.log(type: :info, message: "Configuration::API trace: #{value}")
|
257
|
-
|
258
237
|
options[:trace] = value
|
259
238
|
end
|
260
239
|
alias_method :trace, :trace!
|
@@ -273,9 +252,6 @@ module Vedeu
|
|
273
252
|
def colour_mode(value = nil)
|
274
253
|
fail InvalidSyntax, '`colour_mode` must be `8`, `16`, `256`, ' \
|
275
254
|
'`16777216`.' unless valid_colour_mode?(value)
|
276
|
-
|
277
|
-
Vedeu.log(type: :info, message: "Configuration::API colour_mode: #{value}")
|
278
|
-
|
279
255
|
options[:colour_mode] = value
|
280
256
|
end
|
281
257
|
|
@@ -346,9 +322,6 @@ module Vedeu
|
|
346
322
|
# @return [String|Symbol]
|
347
323
|
def exit_key(value)
|
348
324
|
return invalid_key('exit_key') unless valid_key?(value)
|
349
|
-
|
350
|
-
Vedeu.log(type: :info, message: "Configuration::API exit_key: #{value}")
|
351
|
-
|
352
325
|
system_keys[:exit] = value
|
353
326
|
end
|
354
327
|
|
@@ -367,10 +340,7 @@ module Vedeu
|
|
367
340
|
# @param value [String|Symbol]
|
368
341
|
# @return [String|Symbol]
|
369
342
|
def focus_next_key(value)
|
370
|
-
return invalid_key('
|
371
|
-
|
372
|
-
Vedeu.log(type: :info, message: "Configuration::API focus_next: #{value}")
|
373
|
-
|
343
|
+
return invalid_key('focus_next_key') unless valid_key?(value)
|
374
344
|
system_keys[:focus_next] = value
|
375
345
|
end
|
376
346
|
|
@@ -389,10 +359,7 @@ module Vedeu
|
|
389
359
|
# @param value [String|Symbol]
|
390
360
|
# @return [String|Symbol]
|
391
361
|
def focus_prev_key(value)
|
392
|
-
return invalid_key('
|
393
|
-
|
394
|
-
Vedeu.log(type: :info, message: "Configuration::API focus_prev: #{value}")
|
395
|
-
|
362
|
+
return invalid_key('focus_prev_key') unless valid_key?(value)
|
396
363
|
system_keys[:focus_prev] = value
|
397
364
|
end
|
398
365
|
|
@@ -411,10 +378,7 @@ module Vedeu
|
|
411
378
|
# @param value [String|Symbol]
|
412
379
|
# @return [String|Symbol]
|
413
380
|
def mode_switch_key(value)
|
414
|
-
return invalid_key('
|
415
|
-
|
416
|
-
Vedeu.log(type: :info, message: "Configuration::API mode_switch: #{value}")
|
417
|
-
|
381
|
+
return invalid_key('mode_switch_key') unless valid_key?(value)
|
418
382
|
system_keys[:mode_switch] = value
|
419
383
|
end
|
420
384
|
|
@@ -40,55 +40,39 @@ module Vedeu
|
|
40
40
|
|
41
41
|
opts.on('-i', '--interactive',
|
42
42
|
'Run the application in interactive mode (default).') do
|
43
|
-
Vedeu.log(type: :info, message: "Configuration::CLI interactive: true")
|
44
|
-
|
45
43
|
options[:interactive] = true
|
46
44
|
end
|
47
45
|
|
48
46
|
opts.on('-I', '--noninteractive', '--standalone',
|
49
47
|
'Run the application non-interactively; i.e. not requiring ' \
|
50
48
|
'intervention from the user.') do
|
51
|
-
Vedeu.log(type: :info, message: "Configuration::CLI interactive: false")
|
52
|
-
|
53
49
|
options[:interactive] = false
|
54
50
|
end
|
55
51
|
|
56
52
|
opts.on('-1', '--run-once',
|
57
53
|
'Run the application loop once.') do
|
58
|
-
Vedeu.log(type: :info, message: "Configuration::CLI once: true")
|
59
|
-
|
60
54
|
options[:once] = true
|
61
55
|
end
|
62
56
|
|
63
57
|
opts.on('-n', '--run-many',
|
64
58
|
'Run the application loop continuously (default).') do
|
65
|
-
Vedeu.log(type: :info, message: "Configuration::CLI once: false")
|
66
|
-
|
67
59
|
options[:once] = false
|
68
60
|
end
|
69
61
|
|
70
62
|
opts.on('-c', '--cooked', 'Run application in cooked mode.') do
|
71
|
-
Vedeu.log(type: :info, message: "Configuration::CLI terminal_mode: :cooked")
|
72
|
-
|
73
63
|
options[:terminal_mode] = :cooked
|
74
64
|
end
|
75
65
|
|
76
66
|
opts.on('-r', '--raw', 'Run application in raw mode (default).') do
|
77
|
-
Vedeu.log(type: :info, message: "Configuration::CLI terminal_mode: :raw")
|
78
|
-
|
79
67
|
options[:terminal_mode] = :raw
|
80
68
|
end
|
81
69
|
|
82
70
|
opts.on('-d', '--debug', 'Run application with debugging on.') do
|
83
|
-
Vedeu.log(type: :info, message: "Configuration::CLI debug: true")
|
84
|
-
|
85
71
|
options[:debug] = true
|
86
72
|
end
|
87
73
|
|
88
74
|
opts.on('-D', '--trace', 'Run application with debugging on with ' \
|
89
75
|
'method and event tracing (noisy!).') do
|
90
|
-
Vedeu.log(type: :info, message: "Configuration::CLI trace: true")
|
91
|
-
|
92
76
|
options[:debug] = true
|
93
77
|
options[:trace] = true
|
94
78
|
end
|
@@ -97,13 +81,9 @@ module Vedeu
|
|
97
81
|
'Run application in either `8`, `16`, `256` or `16777216` ' \
|
98
82
|
'colour mode.') do |colours|
|
99
83
|
if [8, 16, 256, 16777216].include?(colours)
|
100
|
-
Vedeu.log(type: :info, message: "Configuration::CLI colour_mode: #{colours}")
|
101
|
-
|
102
84
|
options[:colour_mode] = colours
|
103
85
|
|
104
86
|
else
|
105
|
-
Vedeu.log(type: :info, message: "Configuration::CLI colour_mode: 8 (defaulted)")
|
106
|
-
|
107
87
|
options[:colour_mode] = 8
|
108
88
|
|
109
89
|
end
|
@@ -111,49 +91,39 @@ module Vedeu
|
|
111
91
|
|
112
92
|
opts.on('-l', '--log [FILENAME]', String,
|
113
93
|
'Specify the path for the log file.') do |filename|
|
114
|
-
Vedeu.log(type: :info, message: "Configuration::CLI log: #{filename}")
|
115
|
-
|
116
94
|
options[:log] = filename
|
117
95
|
end
|
118
96
|
|
119
97
|
opts.on('--drb', 'Run application with DRb on.') do
|
120
|
-
Vedeu.log(type: :info, message: "Configuration::CLI drb: true")
|
121
|
-
|
122
98
|
options[:drb] = true
|
123
99
|
end
|
124
100
|
|
125
101
|
opts.on('--drb-host', 'Set the hostname/IP for the DRb server.') do |hostname|
|
126
|
-
Vedeu.log(type: :info, message: "Configuration::CLI drb_host: #{hostname}")
|
127
|
-
|
128
102
|
#options[:drb] = true
|
129
103
|
options[:drb_host] = hostname
|
130
104
|
end
|
131
105
|
|
132
106
|
opts.on('--drb-port', 'Set the port for the DRb server.') do |port|
|
133
|
-
|
134
|
-
|
135
|
-
#options[:drb] = true
|
107
|
+
# options[:drb] = true
|
136
108
|
options[:drb_port] = port
|
137
109
|
end
|
138
110
|
|
139
111
|
opts.on('--drb-height', 'Set the height for fake terminal of the DRb server.') do |height|
|
140
|
-
|
141
|
-
|
142
|
-
#options[:drb] = true
|
112
|
+
# options[:drb] = true
|
143
113
|
options[:drb_height] = height
|
144
114
|
end
|
145
115
|
|
146
116
|
opts.on('--drb-width', 'Set the width for fake terminal of the DRb server.') do |width|
|
147
|
-
|
148
|
-
|
149
|
-
#options[:drb] = true
|
117
|
+
# options[:drb] = true
|
150
118
|
options[:drb_width] = width
|
151
119
|
end
|
152
120
|
end
|
153
121
|
|
154
122
|
parser.parse!(args)
|
155
123
|
|
156
|
-
options
|
124
|
+
options.each do |option, value|
|
125
|
+
Vedeu.log(type: :config, message: "CLI #{option.to_s}: #{value.to_s}")
|
126
|
+
end
|
157
127
|
end
|
158
128
|
|
159
129
|
private
|
@@ -196,8 +196,6 @@ module Vedeu
|
|
196
196
|
#
|
197
197
|
# @return [Hash]
|
198
198
|
def reset!
|
199
|
-
# Vedeu::Log.logger.debug('Resetting configuration.')
|
200
|
-
|
201
199
|
instance.reset!
|
202
200
|
end
|
203
201
|
|
@@ -233,8 +231,6 @@ module Vedeu
|
|
233
231
|
#
|
234
232
|
# @return [Hash]
|
235
233
|
def reset!
|
236
|
-
# Vedeu::Log.logger.debug('Resetting configuration.')
|
237
|
-
|
238
234
|
@options = defaults
|
239
235
|
end
|
240
236
|
|
@@ -73,19 +73,13 @@ module Vedeu
|
|
73
73
|
def restart
|
74
74
|
return not_enabled unless drb?
|
75
75
|
|
76
|
-
|
77
|
-
log('Restarting')
|
78
|
-
|
79
|
-
stop
|
76
|
+
log('Not running') unless drb_running?
|
80
77
|
|
81
|
-
|
78
|
+
log('Restarting')
|
82
79
|
|
83
|
-
|
84
|
-
log('Not running')
|
80
|
+
stop
|
85
81
|
|
86
|
-
|
87
|
-
|
88
|
-
end
|
82
|
+
start
|
89
83
|
end
|
90
84
|
|
91
85
|
# When called will stop the DRb server and attempt to terminate the client
|
@@ -39,12 +39,10 @@ module Vedeu
|
|
39
39
|
#
|
40
40
|
# @raise [InvalidSyntax] The required block was not given.
|
41
41
|
# @return [Keymap]
|
42
|
+
# @todo Try to remember why we need to pre-create the keymap in the
|
43
|
+
# repository.
|
42
44
|
def keymap(name, &block)
|
43
|
-
|
44
|
-
|
45
|
-
# @todo Try to remember why we need to pre-create the keymap in the
|
46
|
-
# repository.
|
47
|
-
Vedeu::Keymap.new(name).store
|
45
|
+
Vedeu::Keymap.new({ name: name }).store
|
48
46
|
|
49
47
|
Vedeu::Keymap.build({ name: name }, &block).store
|
50
48
|
end
|
data/lib/vedeu/input/keymap.rb
CHANGED
@@ -15,51 +15,18 @@ module Vedeu
|
|
15
15
|
|
16
16
|
attr_accessor :name
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
# @option attributes keys []
|
24
|
-
# @option attributes name [String]
|
25
|
-
# @option attributes repository [Vedeu::Repository]
|
26
|
-
# @raise [InvalidSyntax] The required block was not given.
|
27
|
-
# @return [Vedeu::Keymap]
|
28
|
-
def build(attributes = {}, &block)
|
29
|
-
fail InvalidSyntax, 'block not given' unless block_given?
|
30
|
-
|
31
|
-
attributes = defaults.merge(attributes)
|
32
|
-
|
33
|
-
model = new(attributes[:name],
|
34
|
-
attributes[:keys],
|
35
|
-
attributes[:repository])
|
36
|
-
model.deputy(attributes[:client]).instance_eval(&block)
|
37
|
-
model.store
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
# The default values for a new instance of this class.
|
43
|
-
#
|
44
|
-
# @return [Hash]
|
45
|
-
def defaults
|
46
|
-
{
|
47
|
-
client: nil,
|
48
|
-
keys: [],
|
49
|
-
name: '',
|
50
|
-
repository: Vedeu::Keymaps.keymaps,
|
51
|
-
}
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
# @param name [String] The name of the keymap.
|
57
|
-
# @param keys [Vedeu::Model::Collection|Array] A collection of keys.
|
18
|
+
# @param attributes [Hash]
|
19
|
+
# @option attributes name [String] The name of the keymap.
|
20
|
+
# @option attributes keys [Vedeu::Model::Collection|Array] A collection of
|
21
|
+
# keys.
|
22
|
+
# @option attributes repository [Vedeu::Repository] This model's storage.
|
58
23
|
# @return [Vedeu::Keymap]
|
59
|
-
def initialize(
|
60
|
-
@
|
61
|
-
|
62
|
-
@
|
24
|
+
def initialize(attributes = {})
|
25
|
+
@attributes = defaults.merge(attributes)
|
26
|
+
|
27
|
+
@name = @attributes[:name]
|
28
|
+
@keys = @attributes[:keys]
|
29
|
+
@repository = @attributes[:repository]
|
63
30
|
end
|
64
31
|
|
65
32
|
# @param key [Key]
|
@@ -99,6 +66,15 @@ module Vedeu
|
|
99
66
|
|
100
67
|
private
|
101
68
|
|
69
|
+
# @return [Hash]
|
70
|
+
def defaults
|
71
|
+
{
|
72
|
+
name: '',
|
73
|
+
keys: [],
|
74
|
+
repository: Vedeu::Keymaps.keymaps,
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
102
78
|
# Checks that the provided key is not already registered with this keymap.
|
103
79
|
#
|
104
80
|
# @param key [Vedeu::Key]
|
@@ -106,7 +82,8 @@ module Vedeu
|
|
106
82
|
def valid?(key)
|
107
83
|
return true unless key_defined?(key.input)
|
108
84
|
|
109
|
-
Vedeu.log(type:
|
85
|
+
Vedeu.log(type: :debug,
|
86
|
+
message: "Keymap '#{name}' already defines '#{key.input}'.")
|
110
87
|
|
111
88
|
false
|
112
89
|
end
|
data/lib/vedeu/main_loop.rb
CHANGED
data/lib/vedeu/models/focus.rb
CHANGED
@@ -261,6 +261,8 @@ module Vedeu
|
|
261
261
|
right + value
|
262
262
|
end
|
263
263
|
|
264
|
+
private
|
265
|
+
|
264
266
|
# Provides a virtual y position within the interface's dimensions.
|
265
267
|
#
|
266
268
|
# @example
|
@@ -285,8 +287,6 @@ module Vedeu
|
|
285
287
|
(left...right).to_a
|
286
288
|
end
|
287
289
|
|
288
|
-
private
|
289
|
-
|
290
290
|
# The default values for a new instance of this class.
|
291
291
|
#
|
292
292
|
# @return [Hash]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'vedeu/support/content_geometry'
|
2
2
|
require 'vedeu/models/model'
|
3
|
-
require 'vedeu/
|
3
|
+
require 'vedeu/output/presentation'
|
4
4
|
require 'vedeu/buffers/display_buffer'
|
5
5
|
require 'vedeu/buffers/buffer'
|
6
6
|
|
@@ -108,6 +108,9 @@ module Vedeu
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
+
# Fetch the cursor belonging to this interface (by name), if one does not
|
112
|
+
# exist, it will be created, stored and returned.
|
113
|
+
#
|
111
114
|
# @return [Vedeu::Cursor]
|
112
115
|
def cursor
|
113
116
|
Vedeu.cursors.by_name(name)
|
@@ -144,7 +147,6 @@ module Vedeu
|
|
144
147
|
super
|
145
148
|
|
146
149
|
store_new_buffer
|
147
|
-
store_refresh_events
|
148
150
|
store_focusable
|
149
151
|
store_cursor
|
150
152
|
store_group
|
data/lib/vedeu/output/all.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
|
+
require 'vedeu/output/translator'
|
2
|
+
require 'vedeu/output/background'
|
3
|
+
require 'vedeu/output/foreground'
|
4
|
+
|
1
5
|
require 'vedeu/output/border'
|
6
|
+
require 'vedeu/output/colour'
|
2
7
|
require 'vedeu/output/compositor'
|
8
|
+
|
9
|
+
require 'vedeu/output/presentation'
|
10
|
+
require 'vedeu/output/style'
|
3
11
|
require 'vedeu/output/position_index'
|
4
12
|
require 'vedeu/output/virtual_buffer'
|
5
13
|
require 'vedeu/output/html_char'
|
File without changes
|
File without changes
|