vedeu 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu/all.rb +2 -13
- data/lib/vedeu/api.rb +9 -9
- data/lib/vedeu/application/application_view.rb +3 -5
- data/lib/vedeu/bindings/bindings.rb +5 -1
- data/lib/vedeu/bindings/focus.rb +0 -5
- data/lib/vedeu/bindings/refresh.rb +0 -5
- data/lib/vedeu/bindings/system.rb +1 -6
- data/lib/vedeu/colours/all.rb +17 -0
- data/lib/vedeu/colours/background.rb +32 -28
- data/lib/vedeu/colours/backgrounds.rb +13 -9
- data/lib/vedeu/colours/colour.rb +106 -102
- data/lib/vedeu/colours/foreground.rb +32 -28
- data/lib/vedeu/colours/foregrounds.rb +13 -9
- data/lib/vedeu/colours/repository.rb +70 -0
- data/lib/vedeu/colours/translator.rb +267 -0
- data/lib/vedeu/configuration/api.rb +10 -7
- data/lib/vedeu/configuration/configuration.rb +2 -1
- data/lib/vedeu/dsl/border.rb +15 -2
- data/lib/vedeu/dsl/composition.rb +6 -4
- data/lib/vedeu/dsl/geometry.rb +14 -7
- data/lib/vedeu/dsl/group.rb +2 -2
- data/lib/vedeu/dsl/interface.rb +5 -3
- data/lib/vedeu/dsl/keymap.rb +9 -7
- data/lib/vedeu/dsl/line.rb +7 -4
- data/lib/vedeu/dsl/menu.rb +3 -0
- data/lib/vedeu/dsl/presentation.rb +20 -10
- data/lib/vedeu/dsl/shared.rb +4 -4
- data/lib/vedeu/dsl/stream.rb +2 -2
- data/lib/vedeu/dsl/text.rb +11 -5
- data/lib/vedeu/dsl/use.rb +2 -2
- data/lib/vedeu/dsl/view.rb +8 -6
- data/lib/vedeu/events/aliases.rb +91 -0
- data/lib/vedeu/events/all.rb +15 -0
- data/lib/vedeu/events/collection.rb +13 -0
- data/lib/vedeu/events/event.rb +244 -239
- data/lib/vedeu/events/repository.rb +30 -0
- data/lib/vedeu/events/trigger.rb +68 -64
- data/lib/vedeu/exceptions.rb +65 -54
- data/lib/vedeu/geometry/coordinate.rb +3 -1
- data/lib/vedeu/geometry/grid.rb +2 -4
- data/lib/vedeu/input/editor/all.rb +2 -1
- data/lib/vedeu/input/editor/{virtual_cursor.rb → cursor.rb} +10 -10
- data/lib/vedeu/input/editor/document.rb +7 -7
- data/lib/vedeu/input/editor/insert.rb +70 -0
- data/lib/vedeu/input/editor/line.rb +4 -16
- data/lib/vedeu/input/editor/lines.rb +2 -16
- data/lib/vedeu/input/input_translator.rb +2 -2
- data/lib/vedeu/input/key.rb +2 -2
- data/lib/vedeu/internal_api.rb +6 -6
- data/lib/vedeu/log/lockless_log_device.rb +0 -74
- data/lib/vedeu/models/focus.rb +3 -3
- data/lib/vedeu/models/interface.rb +3 -3
- data/lib/vedeu/models/menu.rb +2 -2
- data/lib/vedeu/models/views/char.rb +1 -1
- data/lib/vedeu/models/views/composition.rb +1 -1
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/stream.rb +1 -1
- data/lib/vedeu/models/views/view.rb +6 -7
- data/lib/vedeu/output/presentation/colour.rb +23 -21
- data/lib/vedeu/output/renderers/renderer_options.rb +2 -4
- data/lib/vedeu/output/text.rb +1 -1
- data/lib/vedeu/output/wordwrap.rb +18 -7
- data/lib/vedeu/plugins/plugin.rb +2 -2
- data/lib/vedeu/refresh/refresh_buffer.rb +3 -3
- data/lib/vedeu/refresh/refresh_group.rb +3 -3
- data/lib/vedeu/repositories/repository.rb +7 -6
- data/lib/vedeu/runtime/application.rb +1 -1
- data/lib/vedeu/runtime/main_loop.rb +3 -3
- data/lib/vedeu/runtime/router.rb +14 -11
- data/lib/vedeu/templating/helpers.rb +5 -5
- data/lib/vedeu/templating/template.rb +4 -4
- data/lib/vedeu/templating/view_template.rb +1 -1
- data/lib/vedeu/terminal/terminal.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application/application_view_test.rb +1 -1
- data/test/lib/vedeu/colours/background_test.rb +93 -89
- data/test/lib/vedeu/colours/backgrounds_test.rb +11 -7
- data/test/lib/vedeu/colours/colour_test.rb +155 -151
- data/test/lib/vedeu/colours/foreground_test.rb +93 -89
- data/test/lib/vedeu/colours/foregrounds_test.rb +11 -7
- data/test/lib/vedeu/colours/repository_test.rb +97 -0
- data/test/lib/vedeu/colours/translator_test.rb +173 -0
- data/test/lib/vedeu/configuration/api_test.rb +4 -4
- data/test/lib/vedeu/dsl/border_test.rb +12 -0
- data/test/lib/vedeu/dsl/composition_test.rb +3 -3
- data/test/lib/vedeu/dsl/geometry_test.rb +11 -0
- data/test/lib/vedeu/dsl/group_test.rb +2 -2
- data/test/lib/vedeu/dsl/interface_test.rb +4 -4
- data/test/lib/vedeu/dsl/keymap_test.rb +8 -4
- data/test/lib/vedeu/dsl/line_test.rb +6 -3
- data/test/lib/vedeu/dsl/menu_test.rb +6 -0
- data/test/lib/vedeu/dsl/presentation_test.rb +16 -3
- data/test/lib/vedeu/dsl/stream_test.rb +1 -1
- data/test/lib/vedeu/dsl/text_test.rb +7 -0
- data/test/lib/vedeu/dsl/view_test.rb +3 -3
- data/test/lib/vedeu/events/aliases_test.rb +144 -0
- data/test/lib/vedeu/events/collection_test.rb +22 -0
- data/test/lib/vedeu/events/event_test.rb +84 -80
- data/test/lib/vedeu/events/repository_test.rb +28 -0
- data/test/lib/vedeu/events/trigger_test.rb +41 -37
- data/test/lib/vedeu/geometry/grid_test.rb +4 -4
- data/test/lib/vedeu/input/editor/{virtual_cursor_test.rb → cursor_test.rb} +3 -3
- data/test/lib/vedeu/input/editor/insert_test.rb +36 -0
- data/test/lib/vedeu/input/key_test.rb +1 -1
- data/test/lib/vedeu/models/cell_test.rb +1 -1
- data/test/lib/vedeu/models/focus_test.rb +4 -2
- data/test/lib/vedeu/models/menu_test.rb +1 -1
- data/test/lib/vedeu/models/views/char_test.rb +8 -4
- data/test/lib/vedeu/models/views/line_test.rb +4 -4
- data/test/lib/vedeu/models/views/stream_test.rb +3 -3
- data/test/lib/vedeu/models/views/view_test.rb +1 -1
- data/test/lib/vedeu/output/html_char_test.rb +4 -2
- data/test/lib/vedeu/output/presentation/colour_test.rb +5 -5
- data/test/lib/vedeu/output/presentation_test.rb +4 -4
- data/test/lib/vedeu/output/renderers/json_test.rb +4 -2
- data/test/lib/vedeu/plugins/plugin_test.rb +1 -1
- data/test/lib/vedeu/refresh/refresh_buffer_test.rb +1 -1
- data/test/lib/vedeu/refresh/refresh_group_test.rb +1 -1
- data/test/lib/vedeu/repositories/repository_test.rb +2 -2
- data/test/lib/vedeu/runtime/router_test.rb +6 -6
- data/test/lib/vedeu/templating/decoder_test.rb +2 -3
- data/test/lib/vedeu/templating/encoder_test.rb +2 -3
- data/test/lib/vedeu/templating/helpers_test.rb +6 -6
- data/test/lib/vedeu/templating/template_test.rb +2 -2
- data/test/lib/vedeu/templating/view_template_test.rb +13 -7
- data/test/lib/vedeu/terminal/terminal_test.rb +3 -3
- metadata +24 -19
- data/lib/vedeu/colours/colour_translator.rb +0 -260
- data/lib/vedeu/colours/colours.rb +0 -66
- data/lib/vedeu/events/event_aliases.rb +0 -87
- data/lib/vedeu/events/event_collection.rb +0 -9
- data/lib/vedeu/events/events.rb +0 -26
- data/test/lib/vedeu/colours/colour_translator_test.rb +0 -169
- data/test/lib/vedeu/colours/colours_test.rb +0 -93
- data/test/lib/vedeu/events/event_aliases_test.rb +0 -140
- data/test/lib/vedeu/events/event_collection_test.rb +0 -18
- data/test/lib/vedeu/events/events_test.rb +0 -24
@@ -0,0 +1,30 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
module Events
|
4
|
+
|
5
|
+
# Allows the storing of events.
|
6
|
+
#
|
7
|
+
class Repository < Vedeu::Repository
|
8
|
+
|
9
|
+
singleton_class.send(:alias_method, :events, :repository)
|
10
|
+
|
11
|
+
class << self
|
12
|
+
|
13
|
+
# Remove all stored models from the repository.
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# Vedeu.events.reset!
|
17
|
+
#
|
18
|
+
# @return [Vedeu::Events::Repository]
|
19
|
+
def reset!
|
20
|
+
@events = new(Vedeu::Events::Collection)
|
21
|
+
end
|
22
|
+
alias_method :reset, :reset!
|
23
|
+
|
24
|
+
end # Eigenclass
|
25
|
+
|
26
|
+
end # Repository
|
27
|
+
|
28
|
+
end # Events
|
29
|
+
|
30
|
+
end # Vedeu
|
data/lib/vedeu/events/trigger.rb
CHANGED
@@ -1,84 +1,88 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
# Vedeu.trigger(:my_event, :oxidize, 'nitrogen')
|
10
|
-
#
|
11
|
-
class Trigger
|
12
|
-
|
13
|
-
# @param name [Symbol] The name of the event you wish to trigger. The event
|
14
|
-
# does not have to exist.
|
15
|
-
# @param args [Array] Any arguments the event needs to execute correctly.
|
16
|
-
# @return [Array]
|
17
|
-
def self.trigger(name, *args)
|
18
|
-
new(name, *args).trigger
|
19
|
-
end
|
20
|
-
|
21
|
-
# Returns a new instance of Vedeu::Trigger.
|
3
|
+
module Events
|
4
|
+
|
5
|
+
# Trigger a registered or system event by name with arguments. If the
|
6
|
+
# event stored returns a value, that is returned. If multiple events are
|
7
|
+
# registered for a name, then the result of each event will be returned as
|
8
|
+
# part of a collection.
|
22
9
|
#
|
23
|
-
# @
|
24
|
-
#
|
25
|
-
def initialize(name, *args)
|
26
|
-
@name = name
|
27
|
-
@args = args
|
28
|
-
@repository = Vedeu.events
|
29
|
-
end
|
30
|
-
|
31
|
-
# Trigger the event and return the result or an array of results.
|
10
|
+
# @example
|
11
|
+
# Vedeu.trigger(:my_event, :oxidize, 'nitrogen')
|
32
12
|
#
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
13
|
+
class Trigger
|
14
|
+
|
15
|
+
# @param name [Symbol] The name of the event you wish to trigger. The
|
16
|
+
# event does not have to exist.
|
17
|
+
# @param args [Array] Any arguments the event needs to execute correctly.
|
18
|
+
# @return [Array]
|
19
|
+
def self.trigger(name, *args)
|
20
|
+
new(name, *args).trigger
|
21
|
+
end
|
22
|
+
|
23
|
+
# Returns a new instance of Vedeu::Events::Trigger.
|
24
|
+
#
|
25
|
+
# @param (see .trigger)
|
26
|
+
# @return [Vedeu::Events::Trigger]
|
27
|
+
def initialize(name, *args)
|
28
|
+
@name = name
|
29
|
+
@args = args
|
30
|
+
@repository = Vedeu.events
|
31
|
+
end
|
32
|
+
|
33
|
+
# Trigger the event and return the result or an array of results.
|
34
|
+
#
|
35
|
+
# @return [Array]
|
36
|
+
def trigger
|
37
|
+
if results.one?
|
38
|
+
results[0]
|
37
39
|
|
38
|
-
|
39
|
-
|
40
|
+
else
|
41
|
+
results
|
40
42
|
|
43
|
+
end
|
41
44
|
end
|
42
|
-
end
|
43
45
|
|
44
|
-
|
46
|
+
protected
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
# @!attribute [r] name
|
49
|
+
# @return [Symbol]
|
50
|
+
attr_reader :name
|
49
51
|
|
50
|
-
|
51
|
-
|
52
|
-
|
52
|
+
# @!attribute [r] args
|
53
|
+
# @return [Array]
|
54
|
+
attr_reader :args
|
53
55
|
|
54
|
-
|
55
|
-
|
56
|
-
|
56
|
+
# @!attribute [r]
|
57
|
+
# @return [Vedeu::Repository]
|
58
|
+
attr_reader :repository
|
57
59
|
|
58
|
-
|
60
|
+
private
|
59
61
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
62
|
+
# @return [Array<void>|void]
|
63
|
+
def results
|
64
|
+
@results ||= registered_events.map { |event| event.trigger(*args) }
|
65
|
+
end
|
64
66
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
else
|
73
|
-
Vedeu::EventAliases.find(name).map do |event_name|
|
74
|
-
Vedeu::Trigger.trigger(event_name, *args)
|
75
|
-
end
|
67
|
+
# Return all of the registered events for this name.
|
68
|
+
#
|
69
|
+
# @return [Array|Array<Vedeu::Events::Event>]
|
70
|
+
def registered_events
|
71
|
+
if repository.registered?(name)
|
72
|
+
repository.find(name)
|
76
73
|
|
77
|
-
|
74
|
+
else
|
75
|
+
Vedeu::Events::Aliases.find(name).map do |event_name|
|
76
|
+
Vedeu::Events::Trigger.trigger(event_name, *args)
|
77
|
+
end
|
78
78
|
|
79
|
+
[]
|
80
|
+
|
81
|
+
end
|
79
82
|
end
|
80
|
-
end
|
81
83
|
|
82
|
-
|
84
|
+
end # Trigger
|
85
|
+
|
86
|
+
end # Events
|
83
87
|
|
84
88
|
end # Vedeu
|
data/lib/vedeu/exceptions.rb
CHANGED
@@ -1,78 +1,89 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
#
|
4
|
-
# does not exist.
|
3
|
+
# Custom exceptions which Vedeu will raise in certain circumstances.
|
5
4
|
#
|
6
|
-
|
5
|
+
module Error
|
7
6
|
|
8
|
-
|
7
|
+
# Raised with Vedeu attempts to access a client application controller's
|
8
|
+
# action that does not exist.
|
9
|
+
#
|
10
|
+
class ActionNotFound < StandardError
|
9
11
|
|
10
|
-
|
11
|
-
# action that does not exist.
|
12
|
-
#
|
13
|
-
class ActionNotFound < StandardError
|
12
|
+
end # ActionNotFound
|
14
13
|
|
15
|
-
|
14
|
+
# Raised with Vedeu attempts to access a client application controller that
|
15
|
+
# does not exist.
|
16
|
+
#
|
17
|
+
class ControllerNotFound < StandardError
|
16
18
|
|
17
|
-
|
18
|
-
#
|
19
|
-
class ModelNotFound < StandardError
|
19
|
+
end # ControllerNotFound
|
20
20
|
|
21
|
-
|
21
|
+
# Raised when Vedeu encounters an error.
|
22
|
+
#
|
23
|
+
class Fatal < StandardError
|
22
24
|
|
23
|
-
|
24
|
-
# encounters a problem.
|
25
|
-
#
|
26
|
-
class InvalidSyntax < StandardError
|
25
|
+
end # Fatal
|
27
26
|
|
28
|
-
|
27
|
+
# Raised when Vedeu wishes to exit.
|
28
|
+
#
|
29
|
+
# @see Vedeu::MainLoop
|
30
|
+
#
|
31
|
+
class Interrupt < StandardError
|
29
32
|
|
30
|
-
|
31
|
-
# in a repository.
|
32
|
-
#
|
33
|
-
class MissingRequired < StandardError
|
33
|
+
end # Interrupt
|
34
34
|
|
35
|
-
|
35
|
+
# Raised when Vedeu attempts to parse a view or interface and encounters a
|
36
|
+
# problem.
|
37
|
+
#
|
38
|
+
class InvalidSyntax < StandardError
|
36
39
|
|
37
|
-
|
38
|
-
# cooked, fake and raw terminal modes.
|
39
|
-
#
|
40
|
-
# @see Vedeu::Application
|
41
|
-
#
|
42
|
-
class ModeSwitch < StandardError
|
40
|
+
end # InvalidSyntax
|
43
41
|
|
44
|
-
|
42
|
+
# Raised when a name is not provided for a model when attempting to store it
|
43
|
+
# in a repository.
|
44
|
+
#
|
45
|
+
class MissingRequired < StandardError
|
45
46
|
|
46
|
-
|
47
|
-
# implements the functionality sought.
|
48
|
-
#
|
49
|
-
# @see Vedeu::ColourTranslator
|
50
|
-
#
|
51
|
-
class NotImplemented < StandardError
|
47
|
+
end # MissingRequired
|
52
48
|
|
53
|
-
|
49
|
+
# Raised with Vedeu attempts to access a named model that does not exist.
|
50
|
+
#
|
51
|
+
class ModelNotFound < StandardError
|
54
52
|
|
55
|
-
|
56
|
-
# than 12. Vedeu is hard-wired to a 12-column layout for the time being.
|
57
|
-
#
|
58
|
-
# @see Vedeu::Grid
|
59
|
-
#
|
60
|
-
class OutOfRange < StandardError
|
53
|
+
end # ModelNotFound
|
61
54
|
|
62
|
-
|
55
|
+
# Raised intentionally when the client application wishes to switch between
|
56
|
+
# cooked, fake and raw terminal modes.
|
57
|
+
#
|
58
|
+
# @see Vedeu::Application
|
59
|
+
#
|
60
|
+
class ModeSwitch < StandardError
|
63
61
|
|
64
|
-
|
65
|
-
#
|
66
|
-
class VedeuError < StandardError
|
62
|
+
end # ModeSwitch
|
67
63
|
|
68
|
-
|
64
|
+
# Raised to remind me (or client application developers) that the subclass
|
65
|
+
# implements the functionality sought.
|
66
|
+
#
|
67
|
+
# @see Vedeu::Colours::Translator
|
68
|
+
#
|
69
|
+
class NotImplemented < StandardError
|
69
70
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
end # NotImplemented
|
72
|
+
|
73
|
+
# Raised when trying to access an interface column less than 1 or greater
|
74
|
+
# than 12. Vedeu is hard-wired to a 12-column layout for the time being.
|
75
|
+
#
|
76
|
+
# @see Vedeu::Grid
|
77
|
+
#
|
78
|
+
class OutOfRange < StandardError
|
79
|
+
|
80
|
+
# @return [String]
|
81
|
+
def message
|
82
|
+
'Valid value is between 1 and 12 inclusive.'
|
83
|
+
end
|
84
|
+
|
85
|
+
end # OutOfRange
|
75
86
|
|
76
|
-
end #
|
87
|
+
end # Error
|
77
88
|
|
78
89
|
end # Vedeu
|
@@ -159,13 +159,15 @@ module Vedeu
|
|
159
159
|
|
160
160
|
# Ascertain the correct methods to use for determining the coordinates.
|
161
161
|
#
|
162
|
+
# @raise [Vedeu::Error::InvalidSyntax] When the coordinate type is not
|
163
|
+
# given.
|
162
164
|
# @return [Fixnum]
|
163
165
|
def coordinate_type
|
164
166
|
@_type ||= case type
|
165
167
|
when :x then [:x, :bx, :bxn, :width]
|
166
168
|
when :y then [:y, :by, :byn, :height]
|
167
169
|
else
|
168
|
-
fail Vedeu::InvalidSyntax,
|
170
|
+
fail Vedeu::Error::InvalidSyntax,
|
169
171
|
'Coordinate type not given, cannot continue.'
|
170
172
|
end
|
171
173
|
end
|
data/lib/vedeu/geometry/grid.rb
CHANGED
@@ -29,16 +29,14 @@ module Vedeu
|
|
29
29
|
|
30
30
|
# @see Vedeu::DSL::Geometry#columns
|
31
31
|
def columns
|
32
|
-
fail Vedeu::OutOfRange
|
33
|
-
'Valid value between 1 and 12 inclusive.' if out_of_range?
|
32
|
+
fail Vedeu::Error::OutOfRange if out_of_range?
|
34
33
|
|
35
34
|
column * value
|
36
35
|
end
|
37
36
|
|
38
37
|
# @see Vedeu::DSL::Geometry#rows
|
39
38
|
def rows
|
40
|
-
fail Vedeu::OutOfRange
|
41
|
-
'Valid value between 1 and 12 inclusive.' if out_of_range?
|
39
|
+
fail Vedeu::Error::OutOfRange if out_of_range?
|
42
40
|
|
43
41
|
row * value
|
44
42
|
end
|
@@ -11,8 +11,9 @@ end # Vedeu
|
|
11
11
|
require 'vedeu/input/editor/capture'
|
12
12
|
require 'vedeu/input/editor/cropper'
|
13
13
|
require 'vedeu/input/editor/editor'
|
14
|
+
require 'vedeu/input/editor/insert'
|
14
15
|
require 'vedeu/input/editor/line'
|
15
16
|
require 'vedeu/input/editor/lines'
|
16
|
-
require 'vedeu/input/editor/
|
17
|
+
require 'vedeu/input/editor/cursor'
|
17
18
|
require 'vedeu/input/editor/document'
|
18
19
|
require 'vedeu/input/editor/documents'
|
@@ -4,7 +4,7 @@ module Vedeu
|
|
4
4
|
|
5
5
|
# Maintains a cursor position within the Vedeu::Editor::Document class.
|
6
6
|
#
|
7
|
-
class
|
7
|
+
class Cursor
|
8
8
|
|
9
9
|
# @!attribute [rw] bx
|
10
10
|
# @return [Fixnum]
|
@@ -38,7 +38,7 @@ module Vedeu
|
|
38
38
|
# @return [Fixnum]
|
39
39
|
attr_accessor :y
|
40
40
|
|
41
|
-
# Returns a new instance of Vedeu::Editor::
|
41
|
+
# Returns a new instance of Vedeu::Editor::Cursor.
|
42
42
|
#
|
43
43
|
# @param attributes [Hash]
|
44
44
|
# @option attributes y [Fixnum] The current line.
|
@@ -49,7 +49,7 @@ module Vedeu
|
|
49
49
|
# @option attributes bxn [Fixnum]
|
50
50
|
# @option attributes oy [Fixnum]
|
51
51
|
# @option attributes ox [Fixnum]
|
52
|
-
# @return [Vedeu::Editor::
|
52
|
+
# @return [Vedeu::Editor::Cursor]
|
53
53
|
def initialize(attributes = {})
|
54
54
|
@attributes = defaults.merge!(attributes)
|
55
55
|
|
@@ -60,7 +60,7 @@ module Vedeu
|
|
60
60
|
|
61
61
|
# Move the virtual cursor to the beginning of the line.
|
62
62
|
#
|
63
|
-
# @return [Vedeu::Editor::
|
63
|
+
# @return [Vedeu::Editor::Cursor]
|
64
64
|
def bol
|
65
65
|
@ox = 0
|
66
66
|
@x = 0
|
@@ -70,7 +70,7 @@ module Vedeu
|
|
70
70
|
|
71
71
|
# Move the virtual cursor down by one line.
|
72
72
|
#
|
73
|
-
# @return [Vedeu::Editor::
|
73
|
+
# @return [Vedeu::Editor::Cursor]
|
74
74
|
def down
|
75
75
|
@y += 1
|
76
76
|
|
@@ -79,7 +79,7 @@ module Vedeu
|
|
79
79
|
|
80
80
|
# Move the virtual cursor to the left.
|
81
81
|
#
|
82
|
-
# @return [Vedeu::Editor::
|
82
|
+
# @return [Vedeu::Editor::Cursor]
|
83
83
|
def left
|
84
84
|
@ox -= 1 unless @ox == 0
|
85
85
|
@x -= 1
|
@@ -89,7 +89,7 @@ module Vedeu
|
|
89
89
|
|
90
90
|
# Move the virtual cursor to the origin (0, 0).
|
91
91
|
#
|
92
|
-
# @return [Vedeu::Editor::
|
92
|
+
# @return [Vedeu::Editor::Cursor]
|
93
93
|
def reset!
|
94
94
|
@x = 0
|
95
95
|
@y = 0
|
@@ -101,7 +101,7 @@ module Vedeu
|
|
101
101
|
|
102
102
|
# Move the virtual cursor to the right.
|
103
103
|
#
|
104
|
-
# @return [Vedeu::Editor::
|
104
|
+
# @return [Vedeu::Editor::Cursor]
|
105
105
|
def right
|
106
106
|
@x += 1
|
107
107
|
|
@@ -118,7 +118,7 @@ module Vedeu
|
|
118
118
|
|
119
119
|
# Move the virtual cursor up by one line.
|
120
120
|
#
|
121
|
-
# @return [Vedeu::Editor::
|
121
|
+
# @return [Vedeu::Editor::Cursor]
|
122
122
|
def up
|
123
123
|
@oy -= 1 unless @oy == 0
|
124
124
|
@y -= 1
|
@@ -174,7 +174,7 @@ module Vedeu
|
|
174
174
|
(bx + x) - ox
|
175
175
|
end
|
176
176
|
|
177
|
-
end #
|
177
|
+
end # Cursor
|
178
178
|
|
179
179
|
end # Editor
|
180
180
|
|