vedeu 0.6.40 → 0.6.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.yardopts +7 -0
- data/README.md +10 -0
- data/benchmarks/array_vs_range.rb +41 -0
- data/docs/api.md +7 -0
- data/docs/colours_styles.md +4 -0
- data/docs/debugging.md +19 -0
- data/docs/template.md +1 -0
- data/examples/284_slow_rendering.rb +105 -0
- data/lib/vedeu/borders/dsl.rb +2 -1
- data/lib/vedeu/borders/repository.rb +2 -1
- data/lib/vedeu/buffers/repository.rb +2 -1
- data/lib/vedeu/colours/backgrounds.rb +2 -1
- data/lib/vedeu/colours/foregrounds.rb +2 -1
- data/lib/vedeu/configuration/configuration.rb +3 -1
- data/lib/vedeu/cursors/cursor.rb +3 -1
- data/lib/vedeu/cursors/repository.rb +4 -2
- data/lib/vedeu/distributed/server.rb +5 -2
- data/lib/vedeu/dsl/view.rb +4 -1
- data/lib/vedeu/editor/document.rb +13 -12
- data/lib/vedeu/editor/repository.rb +2 -1
- data/lib/vedeu/events/aliases.rb +3 -1
- data/lib/vedeu/events/event.rb +6 -2
- data/lib/vedeu/events/repository.rb +2 -1
- data/lib/vedeu/events/trigger.rb +2 -1
- data/lib/vedeu/geometry/dsl.rb +2 -1
- data/lib/vedeu/geometry/repository.rb +2 -1
- data/lib/vedeu/groups/clear.rb +2 -1
- data/lib/vedeu/groups/dsl.rb +2 -1
- data/lib/vedeu/groups/group.rb +4 -1
- data/lib/vedeu/groups/repository.rb +2 -1
- data/lib/vedeu/input/dsl.rb +2 -1
- data/lib/vedeu/input/keymaps.rb +2 -1
- data/lib/vedeu/input/mapper.rb +2 -1
- data/lib/vedeu/interfaces/dsl.rb +2 -1
- data/lib/vedeu/interfaces/interface.rb +3 -1
- data/lib/vedeu/interfaces/repository.rb +2 -1
- data/lib/vedeu/logging/all.rb +1 -0
- data/lib/vedeu/logging/debug.rb +2 -1
- data/lib/vedeu/logging/ips.rb +57 -0
- data/lib/vedeu/logging/log.rb +4 -1
- data/lib/vedeu/logging/timer.rb +2 -1
- data/lib/vedeu/menus/menu.rb +2 -1
- data/lib/vedeu/menus/repository.rb +2 -1
- data/lib/vedeu/models/focus.rb +6 -2
- data/lib/vedeu/output/clear/interface.rb +46 -4
- data/lib/vedeu/output/compressor.rb +1 -1
- data/lib/vedeu/output/output.rb +36 -3
- data/lib/vedeu/output/renderers/all.rb +3 -1
- data/lib/vedeu/runtime/application.rb +2 -1
- data/lib/vedeu/runtime/flags.rb +3 -1
- data/lib/vedeu/runtime/main_loop.rb +2 -2
- data/lib/vedeu/runtime/router.rb +2 -1
- data/lib/vedeu/terminal/buffer.rb +27 -8
- data/lib/vedeu/terminal/terminal.rb +4 -1
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/editor/document_test.rb +1 -0
- data/test/lib/vedeu/output/clear/interface_test.rb +1 -0
- data/test/lib/vedeu/output/output_test.rb +45 -1
- data/test/lib/vedeu/terminal/buffer_test.rb +11 -0
- data/test/lib/vedeu_test.rb +2 -0
- data/test/test_helper.rb +21 -0
- data/vedeu.gemspec +1 -0
- metadata +20 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7db3488d578544ebd7396a2c9729aa8d197c29d0
|
|
4
|
+
data.tar.gz: ae67cc4985f4acb9989b6ca86ba0d6b2035b06ba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd84a463c30f4169ad8ec50134fdd16d638d2d5557c4b18d05dab2016a0d190735764ad86cade780e6a10596dcc288e162e5dd759c33ac4aa2501d94341a2dfa
|
|
7
|
+
data.tar.gz: 298aea3fceff6d65d62af1821f5feebe71bbabec593e17f63be2852abd930b5f9f250e4152eee043a4dc05b7c7cb8b92b6d1d2cdd47b769d353feab15b410bde
|
data/.rubocop.yml
CHANGED
data/.yardopts
CHANGED
|
@@ -5,8 +5,12 @@
|
|
|
5
5
|
docs/api.md
|
|
6
6
|
docs/borders.md
|
|
7
7
|
docs/buffer.md
|
|
8
|
+
docs/cell.md
|
|
9
|
+
docs/chars.md
|
|
10
|
+
docs/colours_styles.md
|
|
8
11
|
docs/configuration.md
|
|
9
12
|
docs/cursors.md
|
|
13
|
+
docs/debugging.md
|
|
10
14
|
docs/dsl.md
|
|
11
15
|
docs/events.md
|
|
12
16
|
docs/geometry.md
|
|
@@ -15,8 +19,11 @@ docs/group.md
|
|
|
15
19
|
docs/input.md
|
|
16
20
|
docs/interfaces.md
|
|
17
21
|
docs/keymaps.md
|
|
22
|
+
docs/lines.md
|
|
18
23
|
docs/object_graph.md
|
|
19
24
|
docs/output.md
|
|
25
|
+
docs/streams.md
|
|
26
|
+
docs/template.md
|
|
20
27
|
docs/view.md
|
|
21
28
|
docs/events/application.md
|
|
22
29
|
docs/events/document.md
|
data/README.md
CHANGED
|
@@ -20,6 +20,16 @@ have any problems with either of these operating systems.
|
|
|
20
20
|
**Note**: You may have trouble running Vedeu with Windows installations. (Pull
|
|
21
21
|
requests welcome!)
|
|
22
22
|
|
|
23
|
+
## Dependencies
|
|
24
|
+
|
|
25
|
+
Vedeu relies on the following gems, these will be automatically
|
|
26
|
+
installed when you install Vedeu (as documented below).
|
|
27
|
+
|
|
28
|
+
- bundler
|
|
29
|
+
- rake
|
|
30
|
+
- ruby-prof
|
|
31
|
+
- thor
|
|
32
|
+
- vedeu_cli
|
|
23
33
|
|
|
24
34
|
## Installation
|
|
25
35
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# To test the suitability of using a range to determine a valid
|
|
4
|
+
# coordinate instead of the current array method as used in
|
|
5
|
+
# Vedeu::Terminal::Buffer#within_terminal_boundary?
|
|
6
|
+
#
|
|
7
|
+
# vedeu/benchmarks:spike/benchmarking$ ./array_vs_range.rb
|
|
8
|
+
# Calculating -------------------------------------
|
|
9
|
+
# array 202.400k i/100ms
|
|
10
|
+
# range 130.641k i/100ms
|
|
11
|
+
# -------------------------------------------------
|
|
12
|
+
# array 8.171M (± 0.1%) i/s - 40.885M
|
|
13
|
+
# range 2.471M (± 0.4%) i/s - 12.411M
|
|
14
|
+
#
|
|
15
|
+
# Comparison:
|
|
16
|
+
# array: 8170584.0 i/s
|
|
17
|
+
# range: 2470528.5 i/s - 3.31x slower
|
|
18
|
+
#
|
|
19
|
+
|
|
20
|
+
require "bundler/setup"
|
|
21
|
+
require "benchmark/ips"
|
|
22
|
+
|
|
23
|
+
YN = 60
|
|
24
|
+
XN = 140
|
|
25
|
+
GRID = Array.new(YN) { |y| Array.new(XN) { |x| :"grid_#{y}_#{x}" } }
|
|
26
|
+
Y = rand(YN)
|
|
27
|
+
X = rand(XN)
|
|
28
|
+
|
|
29
|
+
def fast
|
|
30
|
+
GRID[Y] && GRID[Y][X]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def slow
|
|
34
|
+
(0..YN).cover?(Y) && (0..XN).cover?(X)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
Benchmark.ips do |x|
|
|
38
|
+
x.report("array") { fast }
|
|
39
|
+
x.report("range") { slow }
|
|
40
|
+
x.compare!
|
|
41
|
+
end
|
data/docs/api.md
CHANGED
|
@@ -28,6 +28,13 @@ methods are used in a variety of ways, sometimes in combination:
|
|
|
28
28
|
# with other methods
|
|
29
29
|
Vedeu.method_name.other_method
|
|
30
30
|
|
|
31
|
+
Nearly all of the API methods have associated
|
|
32
|
+
{file:docs/events.md Vedeu Events} which you can bind to or trigger to
|
|
33
|
+
achieve the same effect. It is favoured that you trigger events
|
|
34
|
+
instead of calling API methods as this gives you a bit more visibility
|
|
35
|
+
when debugging, and flexibility when running your application.
|
|
36
|
+
However, how you build your application is up to you! (Of course!)
|
|
37
|
+
|
|
31
38
|
## Configuration
|
|
32
39
|
|
|
33
40
|
See {file:docs/configuration.md}
|
data/docs/colours_styles.md
CHANGED
data/docs/debugging.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @title Debugging Vedeu
|
|
2
|
+
# Debugging Vedeu
|
|
3
|
+
|
|
4
|
+
If you are encountering a problem whilst running your client
|
|
5
|
+
application, using Vedeu, and have the 'pry' gem installed or
|
|
6
|
+
available, you can drop the following snippet into the offending area,
|
|
7
|
+
and hopefully be dropped into a Pry debuggging session:
|
|
8
|
+
|
|
9
|
+
Vedeu::Terminal.cooked_mode!
|
|
10
|
+
Vedeu::Terminal.open do
|
|
11
|
+
show_cursor = Vedeu::EscapeSequences::Esc.string('show_cursor')
|
|
12
|
+
Vedeu::Terminal.output(show_cursor)
|
|
13
|
+
|
|
14
|
+
require 'pry'
|
|
15
|
+
binding.pry
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
Vedeu::Terminal.raw_mode!
|
|
19
|
+
|
data/docs/template.md
CHANGED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
require 'vedeu'
|
|
5
|
+
|
|
6
|
+
class EditorApp
|
|
7
|
+
|
|
8
|
+
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
|
9
|
+
|
|
10
|
+
Vedeu.configure do
|
|
11
|
+
debug!
|
|
12
|
+
log '/tmp/284_slow_rendering.log'
|
|
13
|
+
# renderers Vedeu::Renderers::File.new(filename: '/tmp/284_slow.out')
|
|
14
|
+
fake!
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Vedeu.interface :editor_view do
|
|
18
|
+
border do
|
|
19
|
+
title 'Editor'
|
|
20
|
+
end
|
|
21
|
+
editable!
|
|
22
|
+
geometry do
|
|
23
|
+
align(:bottom, :left, Vedeu.width - 21, 10)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
Vedeu.interface :members_view do
|
|
28
|
+
border do
|
|
29
|
+
title 'Members'
|
|
30
|
+
end
|
|
31
|
+
editable!
|
|
32
|
+
geometry do
|
|
33
|
+
align(:top, :right, 20, Vedeu.height)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
Vedeu.interface :help_view do
|
|
38
|
+
geometry do
|
|
39
|
+
height use(:editor_view).height
|
|
40
|
+
width use(:editor_view).width
|
|
41
|
+
x use(:editor_view).left
|
|
42
|
+
y use(:editor_view).south
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# When pressing Return/Enter in the editor view, the :_command_
|
|
47
|
+
# event will be triggered with any typed content you have provided.
|
|
48
|
+
#
|
|
49
|
+
# The :_command_ event in turn triggers the :command event. Bind to
|
|
50
|
+
# :command to retrieve the content entered, and then process
|
|
51
|
+
# yourself in whatever way appropriate.
|
|
52
|
+
#
|
|
53
|
+
# Vedeu.bind(:command) do |data|
|
|
54
|
+
# # ... do something with 'data'
|
|
55
|
+
# end
|
|
56
|
+
#
|
|
57
|
+
Vedeu.keymap :editor_view do
|
|
58
|
+
key(:enter) { Vedeu.trigger(:_editor_execute_, :editor_view) }
|
|
59
|
+
key(:insert) do
|
|
60
|
+
Vedeu.log(type: :debug,
|
|
61
|
+
message: "Commands: #{Vedeu.all_commands.inspect}")
|
|
62
|
+
Vedeu.log(type: :debug,
|
|
63
|
+
message: "Keypresses: #{Vedeu.all_keypresses.inspect}")
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
Vedeu.keymap '_global_' do
|
|
68
|
+
key('q') { Vedeu.exit }
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
Vedeu.render do
|
|
72
|
+
view(:editor_view) do
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
Vedeu.render do
|
|
77
|
+
view(:help_view) do
|
|
78
|
+
lines do
|
|
79
|
+
line 'Type into the editor dialog above,'
|
|
80
|
+
line 'and press Return. This will trigger the'
|
|
81
|
+
line ':command event with the contents of '
|
|
82
|
+
line 'the view.'
|
|
83
|
+
|
|
84
|
+
# @todo Not implemented yet:
|
|
85
|
+
#
|
|
86
|
+
# text 'Type into the editor dialog above, and press Return. This will ' \
|
|
87
|
+
# 'trigger the :_command_ event with the contents of the view.',
|
|
88
|
+
# name: :help_view, mode: :wrap
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
view(:member_view) do
|
|
93
|
+
lines do
|
|
94
|
+
line ''
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def self.start(argv = ARGV)
|
|
100
|
+
Vedeu::Launcher.execute!(argv)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end # EditorApp
|
|
104
|
+
|
|
105
|
+
EditorApp.start
|
data/lib/vedeu/borders/dsl.rb
CHANGED
|
@@ -353,6 +353,8 @@ module Vedeu
|
|
|
353
353
|
# @see Vedeu::Configuration.configure
|
|
354
354
|
# @!method configuration
|
|
355
355
|
# @see Vedeu::Configuration.configuration
|
|
356
|
-
def_delegators Vedeu::Configuration,
|
|
356
|
+
def_delegators Vedeu::Configuration,
|
|
357
|
+
:configure,
|
|
358
|
+
:configuration
|
|
357
359
|
|
|
358
360
|
end # Vedeu
|
data/lib/vedeu/cursors/cursor.rb
CHANGED
|
@@ -316,7 +316,9 @@ module Vedeu
|
|
|
316
316
|
# @see Vedeu::Toggleable::ClassMethods#show
|
|
317
317
|
# @!method toggle_cursor
|
|
318
318
|
# @see Vedeu::Toggleable::ClassMethods#toggle
|
|
319
|
-
def_delegators Vedeu::Cursors::Cursor,
|
|
319
|
+
def_delegators Vedeu::Cursors::Cursor,
|
|
320
|
+
:hide_cursor,
|
|
321
|
+
:show_cursor,
|
|
320
322
|
:toggle_cursor
|
|
321
323
|
|
|
322
324
|
# :nocov:
|
|
@@ -37,7 +37,8 @@ module Vedeu
|
|
|
37
37
|
|
|
38
38
|
# @!method cursor
|
|
39
39
|
# @see Vedeu::Cursors::Repository.cursor
|
|
40
|
-
def_delegators Vedeu::Cursors::Repository,
|
|
40
|
+
def_delegators Vedeu::Cursors::Repository,
|
|
41
|
+
:cursor
|
|
41
42
|
|
|
42
43
|
# Manipulate the repository of cursors.
|
|
43
44
|
#
|
|
@@ -46,6 +47,7 @@ module Vedeu
|
|
|
46
47
|
#
|
|
47
48
|
# @!method cursors
|
|
48
49
|
# @return [Vedeu::Cursors::Repository]
|
|
49
|
-
def_delegators Vedeu::Cursors::Repository,
|
|
50
|
+
def_delegators Vedeu::Cursors::Repository,
|
|
51
|
+
:cursors
|
|
50
52
|
|
|
51
53
|
end # Vedeu
|
|
@@ -246,8 +246,11 @@ module Vedeu
|
|
|
246
246
|
# @see Vedeu::Distributed::Server#status
|
|
247
247
|
# @!method drb_stop
|
|
248
248
|
# @see Vedeu::Distributed::Server#stop
|
|
249
|
-
def_delegators Vedeu::Distributed::Server,
|
|
250
|
-
:
|
|
249
|
+
def_delegators Vedeu::Distributed::Server,
|
|
250
|
+
:drb_restart,
|
|
251
|
+
:drb_start,
|
|
252
|
+
:drb_status,
|
|
253
|
+
:drb_stop
|
|
251
254
|
|
|
252
255
|
# :nocov:
|
|
253
256
|
|
data/lib/vedeu/dsl/view.rb
CHANGED
|
@@ -253,6 +253,9 @@ module Vedeu
|
|
|
253
253
|
# @see Vedeu::DSL::View.renders
|
|
254
254
|
# @!method views
|
|
255
255
|
# @see Vedeu::DSL::View.views
|
|
256
|
-
def_delegators Vedeu::DSL::View,
|
|
256
|
+
def_delegators Vedeu::DSL::View,
|
|
257
|
+
:renders,
|
|
258
|
+
:render,
|
|
259
|
+
:views
|
|
257
260
|
|
|
258
261
|
end # Vedeu
|
|
@@ -64,6 +64,7 @@ module Vedeu
|
|
|
64
64
|
@lines = lines.delete_character(y, x - 1)
|
|
65
65
|
|
|
66
66
|
left
|
|
67
|
+
|
|
67
68
|
end
|
|
68
69
|
end
|
|
69
70
|
|
|
@@ -76,6 +77,8 @@ module Vedeu
|
|
|
76
77
|
up
|
|
77
78
|
|
|
78
79
|
eol
|
|
80
|
+
|
|
81
|
+
refresh
|
|
79
82
|
end
|
|
80
83
|
|
|
81
84
|
# Returns the document as a string with line breaks if there is
|
|
@@ -105,6 +108,8 @@ module Vedeu
|
|
|
105
108
|
@lines = lines.insert_character(character, y, x)
|
|
106
109
|
|
|
107
110
|
right
|
|
111
|
+
|
|
112
|
+
refresh
|
|
108
113
|
end
|
|
109
114
|
|
|
110
115
|
# Insert an empty line.
|
|
@@ -116,6 +121,8 @@ module Vedeu
|
|
|
116
121
|
down
|
|
117
122
|
|
|
118
123
|
bol
|
|
124
|
+
|
|
125
|
+
refresh
|
|
119
126
|
end
|
|
120
127
|
|
|
121
128
|
# Returns the current line from the collection of lines.
|
|
@@ -166,9 +173,7 @@ module Vedeu
|
|
|
166
173
|
def left
|
|
167
174
|
return self if x - 1 < 0
|
|
168
175
|
|
|
169
|
-
cursor.left
|
|
170
|
-
|
|
171
|
-
refresh
|
|
176
|
+
cursor.left.refresh
|
|
172
177
|
end
|
|
173
178
|
|
|
174
179
|
# Move the virtual cursor right.
|
|
@@ -177,9 +182,7 @@ module Vedeu
|
|
|
177
182
|
def right
|
|
178
183
|
return self if x + 1 > line.size
|
|
179
184
|
|
|
180
|
-
cursor.right
|
|
181
|
-
|
|
182
|
-
refresh
|
|
185
|
+
cursor.right.refresh
|
|
183
186
|
end
|
|
184
187
|
|
|
185
188
|
# Move the virtual cursor up.
|
|
@@ -188,7 +191,7 @@ module Vedeu
|
|
|
188
191
|
def up
|
|
189
192
|
return self if y - 1 < 0
|
|
190
193
|
|
|
191
|
-
cursor.up
|
|
194
|
+
cursor.up.refresh
|
|
192
195
|
|
|
193
196
|
if x > line(y).size
|
|
194
197
|
eol
|
|
@@ -205,7 +208,7 @@ module Vedeu
|
|
|
205
208
|
def down
|
|
206
209
|
return self if y + 1 >= lines.size
|
|
207
210
|
|
|
208
|
-
cursor.down
|
|
211
|
+
cursor.down.refresh
|
|
209
212
|
|
|
210
213
|
if x > line(y).size
|
|
211
214
|
eol
|
|
@@ -220,9 +223,7 @@ module Vedeu
|
|
|
220
223
|
#
|
|
221
224
|
# @return [Vedeu::Editor::Document]
|
|
222
225
|
def bol
|
|
223
|
-
cursor.bol
|
|
224
|
-
|
|
225
|
-
refresh
|
|
226
|
+
cursor.bol.refresh
|
|
226
227
|
end
|
|
227
228
|
|
|
228
229
|
# Move the virtual cursor to the end of the line.
|
|
@@ -231,7 +232,7 @@ module Vedeu
|
|
|
231
232
|
def eol
|
|
232
233
|
cursor.x = line.size
|
|
233
234
|
|
|
234
|
-
refresh
|
|
235
|
+
cursor.refresh
|
|
235
236
|
end
|
|
236
237
|
|
|
237
238
|
private
|