vedeu 0.6.9 → 0.6.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/lib/vedeu/all.rb +3 -3
- data/lib/vedeu/api/external.rb +194 -0
- data/lib/vedeu/api/internal.rb +173 -0
- data/lib/vedeu/application/controller.rb +3 -2
- data/lib/vedeu/bindings/application.rb +1 -1
- data/lib/vedeu/bindings/drb.rb +2 -3
- data/lib/vedeu/bindings/movement.rb +1 -1
- data/lib/vedeu/buffers/all.rb +0 -2
- data/lib/vedeu/colours/translator.rb +2 -1
- data/lib/vedeu/common.rb +4 -2
- data/lib/vedeu/configuration/api.rb +1 -1
- data/lib/vedeu/configuration/cli.rb +1 -1
- data/lib/vedeu/cursors/repository.rb +1 -1
- data/lib/vedeu/editor/insert.rb +12 -13
- data/lib/vedeu/geometry/position.rb +1 -1
- data/lib/vedeu/models/cell.rb +35 -21
- data/lib/vedeu/models/escape.rb +18 -1
- data/lib/vedeu/models/page.rb +20 -10
- data/lib/vedeu/models/row.rb +18 -8
- data/lib/vedeu/models/views/char.rb +9 -7
- data/lib/vedeu/models/views/view.rb +1 -1
- data/lib/vedeu/output/compressor.rb +22 -14
- data/lib/vedeu/output/output.rb +1 -10
- data/lib/vedeu/output/renderers/escape_sequence.rb +8 -4
- data/lib/vedeu/output/renderers/file.rb +7 -23
- data/lib/vedeu/output/renderers/html.rb +47 -26
- data/lib/vedeu/output/renderers/json.rb +11 -16
- data/lib/vedeu/output/renderers/null.rb +1 -1
- data/lib/vedeu/output/renderers/renderer_options.rb +2 -1
- data/lib/vedeu/output/renderers/terminal.rb +7 -15
- data/lib/vedeu/output/renderers/text.rb +1 -1
- data/lib/vedeu/output/viewport.rb +154 -143
- data/lib/vedeu/repositories/collection.rb +2 -2
- data/lib/vedeu/repositories/model.rb +25 -26
- data/lib/vedeu/repositories/registerable.rb +9 -8
- data/lib/vedeu/repositories/repository.rb +21 -16
- data/lib/vedeu/repositories/store.rb +6 -4
- data/lib/vedeu/runtime/bootstrap.rb +7 -5
- data/lib/vedeu/runtime/main_loop.rb +2 -0
- data/lib/vedeu/runtime/router.rb +155 -149
- data/lib/vedeu/templating/decoder.rb +8 -5
- data/lib/vedeu/templating/encoder.rb +6 -4
- data/lib/vedeu/templating/template.rb +2 -2
- data/lib/vedeu/templating/view_template.rb +8 -7
- data/lib/vedeu/terminal/buffer.rb +132 -0
- data/lib/vedeu/terminal/terminal.rb +0 -5
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu.rb +2 -2
- data/out_ +50 -0
- data/test/lib/vedeu/api/external_test.rb +62 -0
- data/test/lib/vedeu/{internal_api_test.rb → api/internal_test.rb} +6 -2
- data/test/lib/vedeu/application/controller_test.rb +3 -3
- data/test/lib/vedeu/bindings/application_test.rb +2 -2
- data/test/lib/vedeu/models/cell_test.rb +48 -17
- data/test/lib/vedeu/models/escape_test.rb +29 -7
- data/test/lib/vedeu/models/page_test.rb +70 -50
- data/test/lib/vedeu/models/row_test.rb +40 -20
- data/test/lib/vedeu/output/compressor_test.rb +12 -12
- data/test/lib/vedeu/output/output_test.rb +17 -23
- data/test/lib/vedeu/output/renderers/escape_sequence_test.rb +15 -11
- data/test/lib/vedeu/output/renderers/html_test.rb +66 -68
- data/test/lib/vedeu/output/renderers/json_test.rb +36 -83
- data/test/lib/vedeu/output/renderers/terminal_test.rb +22 -2
- data/test/lib/vedeu/output/viewport_test.rb +201 -197
- data/test/lib/vedeu/runtime/router_test.rb +144 -140
- data/test/lib/vedeu/terminal/buffer_test.rb +307 -0
- data/test/support/examples/material_colours_app.rb +2 -2
- data/test/support/templates/html_renderer.vedeu +24 -0
- metadata +14 -17
- data/lib/vedeu/api.rb +0 -190
- data/lib/vedeu/buffers/virtual_buffer.rb +0 -136
- data/lib/vedeu/buffers/virtual_buffers.rb +0 -77
- data/lib/vedeu/internal_api.rb +0 -173
- data/lib/vedeu/terminal/content.rb +0 -88
- data/test/lib/vedeu/api_test.rb +0 -58
- data/test/lib/vedeu/buffers/virtual_buffer_test.rb +0 -148
- data/test/lib/vedeu/buffers/virtual_buffers_test.rb +0 -73
- data/test/lib/vedeu/terminal/content_test.rb +0 -108
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c164a962e662469f503fd1e4a7c263e6d4c3eace
|
4
|
+
data.tar.gz: 8e28eb50a3e7c7c0f708ec2b118fc8537ecfdf6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 793c0295ed02d41e9e03b6e61417938f3c715464f4a765ed70f04fa386a9034389f659d9b058b565871d15707418dce5802024283797bcd41ea699570c04b30c
|
7
|
+
data.tar.gz: f15f247cb1fcd786e7479e2851234f38d3c7900de8ad0c6a3c691e6970eeaa91de583adfe01a395614cacf5f9373f870716db6751c18159e9931d677d4200a46
|
data/LICENSE.txt
CHANGED
@@ -5,7 +5,7 @@ Copyright (c) 2013 Steve Klabnik - Monologger
|
|
5
5
|
Copyright (c) 2013 Michael Grosser - Ruco
|
6
6
|
(https://github.com/grosser/ruco)
|
7
7
|
Note: Code from ruco's Window class was used as basis of
|
8
|
-
Vedeu::Viewport.
|
8
|
+
Vedeu::Output::Viewport.
|
9
9
|
Copyright (c) 2012 Piotr Murach - TTY
|
10
10
|
(https://github.com/peter-murach/tty)
|
11
11
|
Note: Code used from Plugins infrastructure.
|
data/lib/vedeu/all.rb
CHANGED
@@ -17,7 +17,7 @@ require 'vedeu/configuration/configuration'
|
|
17
17
|
|
18
18
|
require 'vedeu/terminal/mode'
|
19
19
|
require 'vedeu/terminal/terminal'
|
20
|
-
require 'vedeu/terminal/
|
20
|
+
require 'vedeu/terminal/buffer'
|
21
21
|
|
22
22
|
require 'vedeu/runtime/main_loop'
|
23
23
|
require 'vedeu/runtime/flags'
|
@@ -121,8 +121,8 @@ require 'vedeu/output/renderers/terminal'
|
|
121
121
|
require 'vedeu/output/renderers/text'
|
122
122
|
require 'vedeu/output/renderers'
|
123
123
|
|
124
|
-
require 'vedeu/api'
|
125
|
-
require 'vedeu/
|
124
|
+
require 'vedeu/api/external'
|
125
|
+
require 'vedeu/api/internal'
|
126
126
|
|
127
127
|
require 'vedeu/bindings/application'
|
128
128
|
require 'vedeu/bindings/document'
|
@@ -0,0 +1,194 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
module API
|
4
|
+
|
5
|
+
# Provides the API to Vedeu. Methods therein, and classes
|
6
|
+
# belonging to this module expose Vedeu's core functionality.
|
7
|
+
#
|
8
|
+
# These methods are used in a variety of ways, sometimes in
|
9
|
+
# combination:
|
10
|
+
#
|
11
|
+
# # with parameters
|
12
|
+
# Vedeu.method_name(*params)
|
13
|
+
#
|
14
|
+
# # with a block
|
15
|
+
# Vedeu.method_name(*params) do
|
16
|
+
# # ...
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# # with other methods
|
20
|
+
# Vedeu.method_name.other_method
|
21
|
+
#
|
22
|
+
module External
|
23
|
+
|
24
|
+
extend Forwardable
|
25
|
+
|
26
|
+
module_function
|
27
|
+
|
28
|
+
# @!method configure
|
29
|
+
# @see Vedeu::Configuration.configure
|
30
|
+
# @!method configuration
|
31
|
+
# @see Vedeu::Configuration.configuration
|
32
|
+
def_delegators Vedeu::Configuration, :configure, :configuration
|
33
|
+
|
34
|
+
# @!method cursor
|
35
|
+
# @return [Vedeu::Cursors::Cursor]
|
36
|
+
def_delegators Vedeu::Cursors::Repository, :cursor
|
37
|
+
|
38
|
+
# @!method drb_restart
|
39
|
+
# @see Vedeu::Distributed::Server#restart
|
40
|
+
# @!method drb_start
|
41
|
+
# @see Vedeu::Distributed::Server#start
|
42
|
+
# @!method drb_status
|
43
|
+
# @see Vedeu::Distributed::Server#status
|
44
|
+
# @!method drb_stop
|
45
|
+
# @see Vedeu::Distributed::Server#stop
|
46
|
+
def_delegators Vedeu::Distributed::Server, :drb_restart, :drb_start,
|
47
|
+
:drb_status, :drb_stop
|
48
|
+
|
49
|
+
# @!method border
|
50
|
+
# @see Vedeu::Borders::DSL.border
|
51
|
+
def_delegators Vedeu::Borders::DSL, :border
|
52
|
+
|
53
|
+
# @!method geometry
|
54
|
+
# @see Vedeu::Geometry::DSL.geometry
|
55
|
+
def_delegators Vedeu::Geometry::DSL, :geometry
|
56
|
+
|
57
|
+
# @!method group
|
58
|
+
# @see Vedeu::DSL::Group.group
|
59
|
+
def_delegators Vedeu::DSL::Group, :group
|
60
|
+
|
61
|
+
# @!method keymap
|
62
|
+
# @see Vedeu::DSL::Keymap.keymap
|
63
|
+
def_delegators Vedeu::DSL::Keymap, :keymap
|
64
|
+
|
65
|
+
# @!method interface
|
66
|
+
# @see Vedeu::DSL::Interface.interface
|
67
|
+
def_delegators Vedeu::DSL::Interface, :interface
|
68
|
+
|
69
|
+
# @!method render
|
70
|
+
# @see Vedeu::DSL::View.render
|
71
|
+
# @!method renders
|
72
|
+
# @see Vedeu::DSL::View.renders
|
73
|
+
# @!method views
|
74
|
+
# @see Vedeu::DSL::View.views
|
75
|
+
def_delegators Vedeu::DSL::View, :renders, :render, :views
|
76
|
+
|
77
|
+
# @!method bind
|
78
|
+
# @see Vedeu::Events::Event.bind
|
79
|
+
# @!method bound?
|
80
|
+
# @see Vedeu::Events::Event.bound?
|
81
|
+
# @!method unbind
|
82
|
+
# @see Vedeu::Events::Event.unbind
|
83
|
+
def_delegators Vedeu::Events::Event, :bind, :bound?, :unbind
|
84
|
+
|
85
|
+
# @!method bind_alias
|
86
|
+
# @see Vedeu::Events::Aliases#bind_alias
|
87
|
+
# @!method unbind_alias
|
88
|
+
# @see Vedeu::Events::Aliases#unbind_alias
|
89
|
+
def_delegators Vedeu::Events::Aliases, :bind_alias, :unbind_alias
|
90
|
+
|
91
|
+
# @!method focus
|
92
|
+
# @see Vedeu::Models::Focus#focus
|
93
|
+
# @!method focus_by_name
|
94
|
+
# @see Vedeu::Models::Focus#focus_by_name
|
95
|
+
# @!method focussed?
|
96
|
+
# @see Vedeu::Models::Focus#focussed?
|
97
|
+
# @!method focus_next
|
98
|
+
# @see Vedeu::Models::Focus#focus_next
|
99
|
+
# @!method focus_previous
|
100
|
+
# @see Vedeu::Models::Focus#focus_previous
|
101
|
+
def_delegators Vedeu::Models::Focus, :focus, :focus_by_name, :focussed?,
|
102
|
+
:focus_next, :focus_previous
|
103
|
+
|
104
|
+
# @!method log
|
105
|
+
# @see Vedeu::Logging::Log.log
|
106
|
+
# @!method log_stdout
|
107
|
+
# @see Vedeu::Logging::Log.log_stdout
|
108
|
+
# @!method log_stderr
|
109
|
+
# @see Vedeu::Logging::Log.log_stderr
|
110
|
+
def_delegators Vedeu::Logging::Log, :log, :log_stdout, :log_stderr
|
111
|
+
|
112
|
+
# @!method keypress
|
113
|
+
# @see Vedeu::Input::Mapper.keypress
|
114
|
+
def_delegators Vedeu::Input::Mapper, :keypress
|
115
|
+
|
116
|
+
# @!method menu
|
117
|
+
# @see Vedeu::Menus::Menu.menu
|
118
|
+
def_delegators Vedeu::Menus::Menu, :menu
|
119
|
+
|
120
|
+
# @!method goto
|
121
|
+
# @see Vedeu::Runtime::Router#goto
|
122
|
+
def_delegators Vedeu::Runtime::Router, :goto
|
123
|
+
|
124
|
+
# @!method height
|
125
|
+
# @see Vedeu::Terminal#height
|
126
|
+
def_delegators Vedeu::Terminal, :height
|
127
|
+
|
128
|
+
# @!method width
|
129
|
+
# @see Vedeu::Terminal#width
|
130
|
+
def_delegators Vedeu::Terminal, :width
|
131
|
+
|
132
|
+
# @!method trigger
|
133
|
+
# @see Vedeu::Events::Trigger.trigger
|
134
|
+
def_delegators Vedeu::Events::Trigger, :trigger
|
135
|
+
|
136
|
+
# @!method exit
|
137
|
+
# @see Vedeu::Runtime::Application.stop
|
138
|
+
def_delegators Vedeu::Runtime::Application, :exit
|
139
|
+
|
140
|
+
# @!method clear
|
141
|
+
# @see Vedeu::Terminal#clear
|
142
|
+
def_delegators Vedeu::Terminal, :clear
|
143
|
+
|
144
|
+
# @!method clear_by_name
|
145
|
+
# @see Vedeu::Clear::NamedInterface.render
|
146
|
+
def_delegators Vedeu::Clear::NamedInterface, :clear_by_name
|
147
|
+
|
148
|
+
# @!method clear_by_group
|
149
|
+
# @see Vedeu::Clear::NamedGroup.render
|
150
|
+
def_delegators Vedeu::Clear::NamedGroup, :clear_by_group
|
151
|
+
|
152
|
+
# @!method hide_cursor
|
153
|
+
# @see Vedeu::Cursors::Cursor#hide
|
154
|
+
def_delegators Vedeu::Cursors::Cursor, :hide_cursor
|
155
|
+
|
156
|
+
# @!method show_cursor
|
157
|
+
# @see Vedeu::Cursors::Cursor#show
|
158
|
+
def_delegators Vedeu::Cursors::Cursor, :show_cursor
|
159
|
+
|
160
|
+
# @!method toggle_cursor
|
161
|
+
# @see Vedeu::Cursors::Cursor#toggle
|
162
|
+
def_delegators Vedeu::Cursors::Cursor, :toggle_cursor
|
163
|
+
|
164
|
+
# @!method hide_group
|
165
|
+
# @see Vedeu::Models::Group#hide
|
166
|
+
def_delegators Vedeu::Models::Group, :hide_group
|
167
|
+
|
168
|
+
# @!method show_group
|
169
|
+
# @see Vedeu::Models::Group#show
|
170
|
+
def_delegators Vedeu::Models::Group, :show_group
|
171
|
+
|
172
|
+
# @!method toggle_group
|
173
|
+
# @see Vedeu::Models::Group#toggle
|
174
|
+
def_delegators Vedeu::Models::Group, :toggle_group
|
175
|
+
|
176
|
+
# @!method hide_interface
|
177
|
+
# @see Vedeu::Models::Interface#hide
|
178
|
+
def_delegators Vedeu::Models::Interface, :hide_interface
|
179
|
+
|
180
|
+
# @!method show_interface
|
181
|
+
# @see Vedeu::Models::Interface#show
|
182
|
+
def_delegators Vedeu::Models::Interface, :show_interface
|
183
|
+
|
184
|
+
# @!method toggle_interface
|
185
|
+
# @see Vedeu::Models::Interface#toggle
|
186
|
+
def_delegators Vedeu::Models::Interface, :toggle_interface
|
187
|
+
|
188
|
+
end # External
|
189
|
+
|
190
|
+
end # API
|
191
|
+
|
192
|
+
extend Vedeu::API::External
|
193
|
+
|
194
|
+
end # Vedeu
|
@@ -0,0 +1,173 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
module API
|
4
|
+
|
5
|
+
module Internal
|
6
|
+
|
7
|
+
extend Forwardable
|
8
|
+
|
9
|
+
module_function
|
10
|
+
|
11
|
+
# Manipulate the repository of background colours.
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Vedeu.background_colours
|
15
|
+
#
|
16
|
+
# @!method background_colours
|
17
|
+
# @return [Vedeu::Colours::Backgrounds]
|
18
|
+
def_delegators Vedeu::Colours::Backgrounds, :background_colours
|
19
|
+
|
20
|
+
# Manipulate the repository of borders.
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# Vedeu.borders
|
24
|
+
#
|
25
|
+
# @!method borders
|
26
|
+
# @return [Vedeu::Borders::Repository]
|
27
|
+
def_delegators Vedeu::Borders::Repository, :borders
|
28
|
+
|
29
|
+
# Manipulate the repository of buffers.
|
30
|
+
#
|
31
|
+
# @example
|
32
|
+
# Vedeu.buffers
|
33
|
+
#
|
34
|
+
# @!method buffers
|
35
|
+
# @return [Vedeu::Buffers::Repository]
|
36
|
+
def_delegators Vedeu::Buffers::Repository, :buffers
|
37
|
+
|
38
|
+
# Manipulate the repository of cursors.
|
39
|
+
#
|
40
|
+
# @example
|
41
|
+
# Vedeu.cursors
|
42
|
+
#
|
43
|
+
# @!method cursors
|
44
|
+
# @return [Vedeu::Cursors::Repository]
|
45
|
+
def_delegators Vedeu::Cursors::Repository, :cursors
|
46
|
+
|
47
|
+
# Allow debugging via the creation of stack traces courtesy of
|
48
|
+
# ruby-prof.
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
# Vedeu.debug
|
52
|
+
#
|
53
|
+
# @!method debug
|
54
|
+
# @return [Vedeu::Logging::Debug]
|
55
|
+
def_delegators Vedeu::Logging::Debug, :debug
|
56
|
+
|
57
|
+
# Manipulate the repository of documents.
|
58
|
+
#
|
59
|
+
# @example
|
60
|
+
# Vedeu.documents
|
61
|
+
#
|
62
|
+
# @!method documents
|
63
|
+
# @return [Vedeu::Editor::Documents]
|
64
|
+
def_delegators Vedeu::Editor::Documents, :documents
|
65
|
+
|
66
|
+
# Manipulate the repository of events.
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# Vedeu.events
|
70
|
+
#
|
71
|
+
# @!method events
|
72
|
+
# @return [Vedeu::Events::Repository]
|
73
|
+
def_delegators Vedeu::Events::Repository, :events
|
74
|
+
|
75
|
+
# Manipulate the repository of foreground colours.
|
76
|
+
#
|
77
|
+
# @example
|
78
|
+
# Vedeu.foreground_colours
|
79
|
+
#
|
80
|
+
# @!method foreground_colours
|
81
|
+
# @return [Vedeu::Colours::Foregrounds]
|
82
|
+
def_delegators Vedeu::Colours::Foregrounds, :foreground_colours
|
83
|
+
|
84
|
+
# Manipulate the repository of geometries.
|
85
|
+
#
|
86
|
+
# @example
|
87
|
+
# Vedeu.geometries
|
88
|
+
#
|
89
|
+
# @!method geometries
|
90
|
+
# @return [Vedeu::Geometry::Repository]
|
91
|
+
def_delegators Vedeu::Geometry::Repository, :geometries
|
92
|
+
|
93
|
+
# Manipulate the repository of groups.
|
94
|
+
#
|
95
|
+
# @example
|
96
|
+
# Vedeu.groups
|
97
|
+
#
|
98
|
+
# @!method groups
|
99
|
+
# @return [Vedeu::Models::Groups]
|
100
|
+
def_delegators Vedeu::Models::Groups, :groups
|
101
|
+
|
102
|
+
# Manipulate the repository of interfaces.
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
# Vedeu.interfaces
|
106
|
+
#
|
107
|
+
# @!method interfaces
|
108
|
+
# @return [Vedeu::Models::Interfaces]
|
109
|
+
def_delegators Vedeu::Models::Interfaces, :interfaces
|
110
|
+
|
111
|
+
# Manipulate the repository of keymaps.
|
112
|
+
#
|
113
|
+
# @example
|
114
|
+
# Vedeu.keymaps
|
115
|
+
#
|
116
|
+
# @!method keymaps
|
117
|
+
# @return [Vedeu::Input::Keymaps]
|
118
|
+
def_delegators Vedeu::Input::Keymaps, :keymaps
|
119
|
+
|
120
|
+
# Manipulate the repository of menus.
|
121
|
+
#
|
122
|
+
# @example
|
123
|
+
# Vedeu.menus
|
124
|
+
#
|
125
|
+
# @!method menus
|
126
|
+
# @return [Vedeu::Menus::Repository]
|
127
|
+
def_delegators Vedeu::Menus::Repository, :menus
|
128
|
+
|
129
|
+
# Manipulate the internal flags.
|
130
|
+
#
|
131
|
+
# @!method ready?
|
132
|
+
# @!method ready!
|
133
|
+
# @return [Boolean]
|
134
|
+
def_delegators Vedeu::Runtime::Flags, :ready?, :ready!
|
135
|
+
|
136
|
+
# @example
|
137
|
+
# Vedeu.renderer
|
138
|
+
# Vedeu.renderers
|
139
|
+
#
|
140
|
+
# @!method renderer
|
141
|
+
# @see Vedeu::Renderers#renderer
|
142
|
+
# @!method renderers
|
143
|
+
# @see Vedeu::Renderers#renderers
|
144
|
+
def_delegators Vedeu::Renderers, :renderer, :renderers
|
145
|
+
|
146
|
+
# Instruct the terminal to resize. This will happen
|
147
|
+
# automatically as the terminal recieves SIGWINCH signals.
|
148
|
+
#
|
149
|
+
# @example
|
150
|
+
# Vedeu.resize
|
151
|
+
#
|
152
|
+
# @!method resize
|
153
|
+
# @see Vedeu::Terminal#resize
|
154
|
+
def_delegators Vedeu::Terminal, :resize
|
155
|
+
|
156
|
+
# Measure the execution time of the code in the given block.
|
157
|
+
#
|
158
|
+
# @example
|
159
|
+
# Vedeu.timer do
|
160
|
+
# # ... some code here ...
|
161
|
+
# end
|
162
|
+
#
|
163
|
+
# @!method timer
|
164
|
+
# @see Vedeu::Logging::Timer.timer
|
165
|
+
def_delegators Vedeu::Logging::Timer, :timer
|
166
|
+
|
167
|
+
end # Internal
|
168
|
+
|
169
|
+
end # API
|
170
|
+
|
171
|
+
extend Vedeu::API::Internal
|
172
|
+
|
173
|
+
end # Vedeu
|
@@ -31,7 +31,8 @@ module Vedeu
|
|
31
31
|
def controller(controller_name = nil)
|
32
32
|
@controller_name = controller_name
|
33
33
|
|
34
|
-
Vedeu::Router.add_controller(controller_name,
|
34
|
+
Vedeu::Runtime::Router.add_controller(controller_name,
|
35
|
+
ancestors[0].to_s)
|
35
36
|
end
|
36
37
|
alias_method :controller_name, :controller
|
37
38
|
|
@@ -64,7 +65,7 @@ module Vedeu
|
|
64
65
|
# @return [Array<Symbol>]
|
65
66
|
def action(*action_names)
|
66
67
|
action_names.each do |action_name|
|
67
|
-
Vedeu::Router.add_action(@controller_name, action_name)
|
68
|
+
Vedeu::Runtime::Router.add_action(@controller_name, action_name)
|
68
69
|
end
|
69
70
|
end
|
70
71
|
alias_method :action_name, :action
|
@@ -21,7 +21,7 @@ module Vedeu
|
|
21
21
|
# See {file:docs/events/application.md#\_goto_}
|
22
22
|
def goto!
|
23
23
|
Vedeu.bind(:_goto_) do |controller, action, **args|
|
24
|
-
Vedeu::Router.goto(controller, action, **args)
|
24
|
+
Vedeu::Runtime::Router.goto(controller, action, **args)
|
25
25
|
end
|
26
26
|
|
27
27
|
Vedeu.bind_alias(:_action_, :_goto_)
|
data/lib/vedeu/bindings/drb.rb
CHANGED
@@ -40,15 +40,14 @@ module Vedeu
|
|
40
40
|
# See {file:docs/events/drb.md#\_drb_retrieve_output_}
|
41
41
|
def drb_retrieve_output!
|
42
42
|
Vedeu.bind(:_drb_retrieve_output_) do
|
43
|
-
Vedeu::
|
43
|
+
Vedeu::Terminal::Buffer.output
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
# See {file:docs/events/drb.md#\_drb_store_output_}
|
48
48
|
def drb_store_output!
|
49
49
|
Vedeu.bind(:_drb_store_output_) do |data|
|
50
|
-
Vedeu::
|
51
|
-
.store(Vedeu::Buffers::VirtualBuffer.output(data))
|
50
|
+
Vedeu::Terminal::Buffer.write(data)
|
52
51
|
end
|
53
52
|
end
|
54
53
|
|
@@ -23,7 +23,7 @@ module Vedeu
|
|
23
23
|
|
24
24
|
# See {file:docs/events/movement.md#\_cursor_up_down_left_right_}
|
25
25
|
def directional!
|
26
|
-
|
26
|
+
%w(down left right up).each do |direction|
|
27
27
|
Vedeu.bind("_cursor_#{direction}_".to_sym) do |name|
|
28
28
|
Vedeu.cursors.by_name(name).send("move_#{direction}")
|
29
29
|
|
data/lib/vedeu/buffers/all.rb
CHANGED
data/lib/vedeu/common.rb
CHANGED
@@ -34,9 +34,11 @@ module Vedeu
|
|
34
34
|
name
|
35
35
|
end
|
36
36
|
|
37
|
-
# Returns a boolean indicating whether a variable has a useful
|
37
|
+
# Returns a boolean indicating whether a variable has a useful
|
38
|
+
# value.
|
38
39
|
#
|
39
|
-
# @param variable [String|Symbol|Array|Fixnum] The variable to
|
40
|
+
# @param variable [String|Symbol|Array|Fixnum] The variable to
|
41
|
+
# check.
|
40
42
|
# @return [Boolean]
|
41
43
|
def present?(variable)
|
42
44
|
return true if variable.is_a?(Fixnum)
|
@@ -313,7 +313,7 @@ module Vedeu
|
|
313
313
|
# @param renderer [Array<Class>|Class]
|
314
314
|
# @return [Array<Class>]
|
315
315
|
def renderer(*renderer)
|
316
|
-
options[:renderers] =
|
316
|
+
options[:renderers] = renderer
|
317
317
|
end
|
318
318
|
alias_method :renderers, :renderer
|
319
319
|
|
@@ -17,7 +17,7 @@ module Vedeu
|
|
17
17
|
#
|
18
18
|
# Configure Vedeu via command-line arguments. Options set here
|
19
19
|
# via arguments override the client application configuration
|
20
|
-
# set via {Vedeu::API#configure}.
|
20
|
+
# set via {Vedeu::API::External#configure}.
|
21
21
|
#
|
22
22
|
# @param args [Array]
|
23
23
|
# @return [Vedeu::Configuration::CLI]
|
data/lib/vedeu/editor/insert.rb
CHANGED
@@ -29,16 +29,8 @@ module Vedeu
|
|
29
29
|
# @return [Vedeu::Editor::Line|Vedeu::Editor::Lines]
|
30
30
|
def insert
|
31
31
|
if index
|
32
|
-
|
33
|
-
collection.insert(0, entity)
|
32
|
+
collection.insert(index, entity)
|
34
33
|
|
35
|
-
elsif index >= size
|
36
|
-
collection << entity
|
37
|
-
|
38
|
-
else
|
39
|
-
collection.insert(index, entity)
|
40
|
-
|
41
|
-
end
|
42
34
|
else
|
43
35
|
collection << entity
|
44
36
|
|
@@ -55,14 +47,21 @@ module Vedeu
|
|
55
47
|
# @return [String]
|
56
48
|
attr_reader :entity
|
57
49
|
|
58
|
-
# @!attribute [r] index
|
59
|
-
# @return [Fixnum]
|
60
|
-
attr_reader :index
|
61
|
-
|
62
50
|
# @!attribute [r] size
|
63
51
|
# @return [Fixnum]
|
64
52
|
attr_reader :size
|
65
53
|
|
54
|
+
private
|
55
|
+
|
56
|
+
# @return [Fixnum]
|
57
|
+
def index
|
58
|
+
return nil unless @index
|
59
|
+
|
60
|
+
@index = 0 if @index < 0
|
61
|
+
@index = size if @index > size
|
62
|
+
@index
|
63
|
+
end
|
64
|
+
|
66
65
|
end # Insert
|
67
66
|
|
68
67
|
end # Editor
|
data/lib/vedeu/models/cell.rb
CHANGED
@@ -18,14 +18,6 @@ module Vedeu
|
|
18
18
|
# @return [NilClass|String]
|
19
19
|
attr_reader :value
|
20
20
|
|
21
|
-
# @!attribute [r] x
|
22
|
-
# @return [NilClass|Fixnum]
|
23
|
-
attr_reader :x
|
24
|
-
|
25
|
-
# @!attribute [r] y
|
26
|
-
# @return [NilClass|Fixnum]
|
27
|
-
attr_reader :y
|
28
|
-
|
29
21
|
# Returns a new instance of Vedeu::Models::Cell.
|
30
22
|
#
|
31
23
|
# @param attributes [Hash<Symbol => Array<Symbol|String>,
|
@@ -34,14 +26,11 @@ module Vedeu
|
|
34
26
|
# @option attributes style
|
35
27
|
# [NilClass|Array<Symbol|String>|Symbol|String]
|
36
28
|
# @option attributes value [NilClass|String]
|
37
|
-
# @option attributes
|
38
|
-
# @option attributes y [NilClass|Fixnum]
|
29
|
+
# @option attributes position [Vedeu::Geometry::Position]
|
39
30
|
# @return [Vedeu::Models::Cell]
|
40
31
|
def initialize(attributes = {})
|
41
|
-
|
42
|
-
|
43
|
-
@attributes.each do |key, value|
|
44
|
-
instance_variable_set("@#{key}", value)
|
32
|
+
defaults.merge!(attributes).each do |key, value|
|
33
|
+
instance_variable_set("@#{key}", value || defaults.fetch(key))
|
45
34
|
end
|
46
35
|
end
|
47
36
|
|
@@ -50,11 +39,37 @@ module Vedeu
|
|
50
39
|
# @param other [Vedeu::Models::Cell]
|
51
40
|
# @return [Boolean]
|
52
41
|
def eql?(other)
|
53
|
-
self.class == other.class && value == other.value &&
|
54
|
-
|
42
|
+
self.class == other.class && value == other.value &&
|
43
|
+
position == other.position
|
55
44
|
end
|
56
45
|
alias_method :==, :eql?
|
57
46
|
|
47
|
+
# @return [Vedeu::Geometry::Position]
|
48
|
+
def position
|
49
|
+
Vedeu::Geometry::Position.coerce(@position)
|
50
|
+
end
|
51
|
+
|
52
|
+
# @return [Hash]
|
53
|
+
def to_hash
|
54
|
+
{
|
55
|
+
colour: colour.to_s,
|
56
|
+
style: style.to_s,
|
57
|
+
value: value.to_s,
|
58
|
+
position: position.to_s,
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
# @param options [Hash] Ignored.
|
63
|
+
# @return [String]
|
64
|
+
def to_html(_options = {})
|
65
|
+
''
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [String]
|
69
|
+
def to_s
|
70
|
+
value.to_s
|
71
|
+
end
|
72
|
+
|
58
73
|
private
|
59
74
|
|
60
75
|
# Returns the default options/attributes for this class.
|
@@ -62,11 +77,10 @@ module Vedeu
|
|
62
77
|
# @return [Hash<Symbol => void>]
|
63
78
|
def defaults
|
64
79
|
{
|
65
|
-
colour:
|
66
|
-
style:
|
67
|
-
value:
|
68
|
-
|
69
|
-
y: nil,
|
80
|
+
colour: nil,
|
81
|
+
style: nil,
|
82
|
+
value: '',
|
83
|
+
position: [1, 1],
|
70
84
|
}
|
71
85
|
end
|
72
86
|
|