vedeu 0.6.7 → 0.6.8
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/docs/dsl.md +4 -4
- data/lib/vedeu/all.rb +6 -18
- data/lib/vedeu/api.rb +14 -13
- data/lib/vedeu/bindings/system.rb +5 -4
- data/lib/vedeu/buffers/virtual_buffer.rb +13 -11
- data/lib/vedeu/configuration/api.rb +4 -3
- data/lib/vedeu/cursors/cursor.rb +23 -18
- data/lib/vedeu/distributed/client.rb +11 -6
- data/lib/vedeu/distributed/server.rb +4 -3
- data/lib/vedeu/dsl/keymap.rb +6 -6
- data/lib/vedeu/editor/all.rb +19 -0
- data/lib/vedeu/{input/editor → editor}/capture.rb +1 -1
- data/lib/vedeu/{input/editor → editor}/cropper.rb +0 -0
- data/lib/vedeu/{input/editor → editor}/cursor.rb +0 -0
- data/lib/vedeu/{input/editor → editor}/document.rb +0 -0
- data/lib/vedeu/{input/editor → editor}/documents.rb +0 -0
- data/lib/vedeu/{input/editor → editor}/editor.rb +0 -0
- data/lib/vedeu/{input/editor → editor}/insert.rb +0 -0
- data/lib/vedeu/{input/editor → editor}/line.rb +0 -0
- data/lib/vedeu/{input/editor → editor}/lines.rb +0 -0
- data/lib/vedeu/error.rb +21 -18
- data/lib/vedeu/esc/borders.rb +6 -4
- data/lib/vedeu/esc/colours.rb +13 -12
- data/lib/vedeu/esc/esc.rb +11 -10
- data/lib/vedeu/input/all.rb +15 -0
- data/lib/vedeu/input/input.rb +55 -52
- data/lib/vedeu/input/key.rb +36 -30
- data/lib/vedeu/input/keymap.rb +101 -92
- data/lib/vedeu/input/keymaps.rb +10 -6
- data/lib/vedeu/input/keys.rb +8 -4
- data/lib/vedeu/input/mapper.rb +125 -121
- data/lib/vedeu/input/translator.rb +159 -0
- data/lib/vedeu/internal_api.rb +16 -15
- data/lib/vedeu/logging/all.rb +13 -0
- data/lib/vedeu/logging/debug.rb +84 -0
- data/lib/vedeu/logging/lockless_log_device.rb +65 -0
- data/lib/vedeu/logging/log.rb +179 -0
- data/lib/vedeu/logging/mono_logger.rb +26 -0
- data/lib/vedeu/logging/timer.rb +68 -0
- data/lib/vedeu/menus/all.rb +12 -0
- data/lib/vedeu/{dsl/menu.rb → menus/dsl.rb} +19 -18
- data/lib/vedeu/menus/menu.rb +234 -0
- data/lib/vedeu/{null/menu.rb → menus/null.rb} +6 -6
- data/lib/vedeu/menus/repository.rb +18 -0
- data/lib/vedeu/models/cell.rb +62 -55
- data/lib/vedeu/models/escape.rb +55 -50
- data/lib/vedeu/models/page.rb +74 -69
- data/lib/vedeu/models/row.rb +55 -51
- data/lib/vedeu/models/views/all.rb +1 -0
- data/lib/vedeu/models/views/char.rb +1 -1
- data/lib/vedeu/models/views/html_char.rb +165 -0
- data/lib/vedeu/output/renderers/html.rb +5 -4
- data/lib/vedeu/repositories/model.rb +2 -0
- data/lib/vedeu/runtime/application.rb +110 -103
- data/lib/vedeu/runtime/bootstrap.rb +109 -103
- data/lib/vedeu/runtime/flags.rb +45 -41
- data/lib/vedeu/runtime/launcher.rb +1 -1
- data/lib/vedeu/runtime/main_loop.rb +51 -46
- data/lib/vedeu/runtime/traps.rb +20 -16
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu.rb +2 -2
- data/test/lib/vedeu/buffers/virtual_buffer_test.rb +1 -1
- data/test/lib/vedeu/cursors/cursor_test.rb +11 -5
- data/test/lib/vedeu/dsl/interface_test.rb +1 -1
- data/test/lib/vedeu/dsl/keymap_test.rb +2 -2
- data/test/lib/vedeu/{input/editor → editor}/capture_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/cropper_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/cursor_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/document_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/documents_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/editor_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/insert_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/line_test.rb +0 -0
- data/test/lib/vedeu/{input/editor → editor}/lines_test.rb +0 -0
- data/test/lib/vedeu/input/input_test.rb +58 -54
- data/test/lib/vedeu/input/key_test.rb +29 -25
- data/test/lib/vedeu/input/keymap_test.rb +74 -70
- data/test/lib/vedeu/input/keymaps_test.rb +8 -4
- data/test/lib/vedeu/input/keys_test.rb +12 -8
- data/test/lib/vedeu/input/mapper_test.rb +64 -56
- data/test/lib/vedeu/input/translator_test.rb +36 -0
- data/test/lib/vedeu/logging/debug_test.rb +39 -0
- data/test/lib/vedeu/logging/lockless_log_device_test.rb +42 -0
- data/test/lib/vedeu/logging/log_test.rb +52 -0
- data/test/lib/vedeu/logging/mono_logger_test.rb +43 -0
- data/test/lib/vedeu/logging/timer_test.rb +44 -0
- data/test/lib/vedeu/{dsl/menu_test.rb → menus/dsl_test.rb} +6 -6
- data/test/lib/vedeu/menus/menu_test.rb +305 -0
- data/test/lib/vedeu/{null/menu_test.rb → menus/null_test.rb} +5 -5
- data/test/lib/vedeu/menus/repository_test.rb +17 -0
- data/test/lib/vedeu/models/cell_test.rb +54 -50
- data/test/lib/vedeu/models/escape_test.rb +49 -45
- data/test/lib/vedeu/models/page_test.rb +167 -160
- data/test/lib/vedeu/models/row_test.rb +71 -67
- data/test/lib/vedeu/models/views/html_char_test.rb +110 -0
- data/test/lib/vedeu/output/compressor_test.rb +44 -22
- data/test/lib/vedeu/output/renderers_test.rb +4 -2
- data/test/lib/vedeu/runtime/application_test.rb +36 -32
- data/test/lib/vedeu/runtime/bootstrap_test.rb +31 -26
- data/test/lib/vedeu/runtime/flags_test.rb +33 -29
- data/test/lib/vedeu/runtime/launcher_test.rb +4 -2
- data/test/lib/vedeu/runtime/main_loop_test.rb +28 -24
- data/test/lib/vedeu/runtime/traps_test.rb +8 -4
- data/test/test_helper.rb +4 -2
- metadata +66 -63
- data/lib/vedeu/input/editor/all.rb +0 -19
- data/lib/vedeu/input/input_translator.rb +0 -155
- data/lib/vedeu/log/debug.rb +0 -79
- data/lib/vedeu/log/lockless_log_device.rb +0 -61
- data/lib/vedeu/log/log.rb +0 -172
- data/lib/vedeu/log/mono_logger.rb +0 -21
- data/lib/vedeu/log/timer.rb +0 -63
- data/lib/vedeu/models/menu.rb +0 -217
- data/lib/vedeu/models/menus.rb +0 -14
- data/lib/vedeu/output/html_char.rb +0 -161
- data/test/lib/vedeu/input/input_translator_test.rb +0 -32
- data/test/lib/vedeu/log/debug_test.rb +0 -35
- data/test/lib/vedeu/log/lockless_log_device_test.rb +0 -29
- data/test/lib/vedeu/log/log_test.rb +0 -48
- data/test/lib/vedeu/log/mono_logger_test.rb +0 -31
- data/test/lib/vedeu/log/timer_test.rb +0 -40
- data/test/lib/vedeu/models/menu_test.rb +0 -301
- data/test/lib/vedeu/models/menus_test.rb +0 -13
- data/test/lib/vedeu/output/html_char_test.rb +0 -106
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43c20341c0356017348e3f761aa1b1371b5d5d53
|
4
|
+
data.tar.gz: bc914cbb3ca7912bc37b6d519edd74caafc71945
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc099e2bab2c7849429e57de5de0549889195bfc19833ee93644a45d609e8426cae6289c3df6e97846fe8d4a2eaecf3219ff4d1d32688387e69c4c2bf76e68af
|
7
|
+
data.tar.gz: 2c28487ea4337f6887775d6eeedf9d77f70766a3e7db89e915f9e61577c7b9103574cf537536b1fac39b0b1ca9762832282fc06de0ed775bae0f6ea868ae410a
|
data/LICENSE.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Copyright (c) 2014 Gavin Laking
|
2
2
|
Copyright (c) 2013 Steve Klabnik - Monologger
|
3
3
|
(https://github.com/steveklabnik/mono_logger)
|
4
|
-
Note: Code used inline in Vedeu::Log.
|
4
|
+
Note: Code used inline in Vedeu::Logging::Log.
|
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
|
data/docs/dsl.md
CHANGED
@@ -134,10 +134,10 @@ end
|
|
134
134
|
|
135
135
|
## Menus
|
136
136
|
|
137
|
-
{include:Vedeu::DSL
|
138
|
-
{include:Vedeu::DSL
|
139
|
-
{include:Vedeu::DSL
|
140
|
-
{include:Vedeu::DSL
|
137
|
+
{include:Vedeu::Menus::DSL}
|
138
|
+
{include:Vedeu::Menus::DSL#item}
|
139
|
+
{include:Vedeu::Menus::DSL#items}
|
140
|
+
{include:Vedeu::Menus::DSL#name}
|
141
141
|
|
142
142
|
## Views
|
143
143
|
|
data/lib/vedeu/all.rb
CHANGED
@@ -4,11 +4,9 @@ require 'vedeu/options'
|
|
4
4
|
require 'vedeu/runtime/launcher'
|
5
5
|
require 'vedeu/runtime/bootstrap'
|
6
6
|
require 'vedeu/error'
|
7
|
-
|
8
|
-
require 'vedeu/
|
9
|
-
|
10
|
-
require 'vedeu/log/debug'
|
11
|
-
require 'vedeu/log/timer'
|
7
|
+
|
8
|
+
require 'vedeu/logging/all'
|
9
|
+
|
12
10
|
require 'vedeu/runtime/traps'
|
13
11
|
require 'vedeu/common'
|
14
12
|
require 'vedeu/runtime/router'
|
@@ -37,7 +35,6 @@ require 'vedeu/repositories/repository'
|
|
37
35
|
require 'vedeu/null/null'
|
38
36
|
require 'vedeu/null/generic'
|
39
37
|
require 'vedeu/null/interface'
|
40
|
-
require 'vedeu/null/menu'
|
41
38
|
require 'vedeu/null/view'
|
42
39
|
|
43
40
|
require 'vedeu/refresh/refresh'
|
@@ -57,8 +54,6 @@ require 'vedeu/models/escape'
|
|
57
54
|
require 'vedeu/models/focus'
|
58
55
|
require 'vedeu/models/group'
|
59
56
|
require 'vedeu/models/groups'
|
60
|
-
require 'vedeu/models/menu'
|
61
|
-
require 'vedeu/models/menus'
|
62
57
|
require 'vedeu/models/row'
|
63
58
|
require 'vedeu/models/page'
|
64
59
|
|
@@ -92,24 +87,18 @@ require 'vedeu/dsl/keymap'
|
|
92
87
|
require 'vedeu/dsl/text'
|
93
88
|
require 'vedeu/dsl/interface'
|
94
89
|
require 'vedeu/dsl/line'
|
95
|
-
require 'vedeu/dsl/menu'
|
96
90
|
require 'vedeu/dsl/stream'
|
97
91
|
require 'vedeu/dsl/view'
|
98
92
|
|
99
|
-
require 'vedeu/input/input_translator'
|
100
|
-
require 'vedeu/input/mapper'
|
101
|
-
require 'vedeu/input/key'
|
102
|
-
require 'vedeu/input/input'
|
103
|
-
require 'vedeu/input/keymap'
|
104
|
-
require 'vedeu/input/keymaps'
|
105
|
-
require 'vedeu/input/editor/all'
|
106
|
-
|
107
93
|
require 'vedeu/borders/all'
|
108
94
|
require 'vedeu/buffers/all'
|
109
95
|
require 'vedeu/colours/all'
|
110
96
|
require 'vedeu/cursors/all'
|
97
|
+
require 'vedeu/editor/all'
|
111
98
|
require 'vedeu/events/all'
|
112
99
|
require 'vedeu/geometry/all'
|
100
|
+
require 'vedeu/input/all'
|
101
|
+
require 'vedeu/menus/all'
|
113
102
|
|
114
103
|
require 'vedeu/output/direct'
|
115
104
|
require 'vedeu/output/clear/named_group'
|
@@ -118,7 +107,6 @@ require 'vedeu/output/presentation'
|
|
118
107
|
require 'vedeu/output/compressor'
|
119
108
|
require 'vedeu/output/style'
|
120
109
|
require 'vedeu/output/text'
|
121
|
-
require 'vedeu/output/html_char'
|
122
110
|
require 'vedeu/output/output'
|
123
111
|
require 'vedeu/output/viewport'
|
124
112
|
require 'vedeu/output/wordwrap'
|
data/lib/vedeu/api.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
# Provides the API to Vedeu. Methods therein, and classes belonging
|
4
|
-
# module expose Vedeu's core functionality.
|
3
|
+
# Provides the API to Vedeu. Methods therein, and classes belonging
|
4
|
+
# to this module expose Vedeu's core functionality.
|
5
5
|
#
|
6
|
-
# These methods are used in a variety of ways, sometimes in
|
6
|
+
# These methods are used in a variety of ways, sometimes in
|
7
|
+
# combination:
|
7
8
|
#
|
8
9
|
# # with parameters
|
9
10
|
# Vedeu.method_name(*params)
|
@@ -99,20 +100,20 @@ module Vedeu
|
|
99
100
|
:focus_next, :focus_previous
|
100
101
|
|
101
102
|
# @!method log
|
102
|
-
# @see Vedeu::Log.log
|
103
|
+
# @see Vedeu::Logging::Log.log
|
103
104
|
# @!method log_stdout
|
104
|
-
# @see Vedeu::Log.log_stdout
|
105
|
+
# @see Vedeu::Logging::Log.log_stdout
|
105
106
|
# @!method log_stderr
|
106
|
-
# @see Vedeu::Log.log_stderr
|
107
|
-
def_delegators Vedeu::Log, :log, :log_stdout, :log_stderr
|
107
|
+
# @see Vedeu::Logging::Log.log_stderr
|
108
|
+
def_delegators Vedeu::Logging::Log, :log, :log_stdout, :log_stderr
|
108
109
|
|
109
110
|
# @!method keypress
|
110
|
-
# @see Vedeu::Mapper.keypress
|
111
|
-
def_delegators Vedeu::Mapper, :keypress
|
111
|
+
# @see Vedeu::Input::Mapper.keypress
|
112
|
+
def_delegators Vedeu::Input::Mapper, :keypress
|
112
113
|
|
113
114
|
# @!method menu
|
114
|
-
# @see Vedeu::Menu.menu
|
115
|
-
def_delegators Vedeu::Menu, :menu
|
115
|
+
# @see Vedeu::Menus::Menu.menu
|
116
|
+
def_delegators Vedeu::Menus::Menu, :menu
|
116
117
|
|
117
118
|
# @!method goto
|
118
119
|
# @see Vedeu::Router#goto
|
@@ -131,8 +132,8 @@ module Vedeu
|
|
131
132
|
def_delegators Vedeu::Events::Trigger, :trigger
|
132
133
|
|
133
134
|
# @!method exit
|
134
|
-
# @see Vedeu::Application.stop
|
135
|
-
def_delegators Vedeu::Application, :exit
|
135
|
+
# @see Vedeu::Runtime::Application.stop
|
136
|
+
def_delegators Vedeu::Runtime::Application, :exit
|
136
137
|
|
137
138
|
# @!method clear
|
138
139
|
# @see Vedeu::Terminal#clear
|
@@ -77,8 +77,9 @@ module Vedeu
|
|
77
77
|
Vedeu.bind(:_command_) { |command| Vedeu.trigger(:command, command) }
|
78
78
|
end
|
79
79
|
|
80
|
-
# This event is called by {Vedeu::Input#capture}. When
|
81
|
-
# key will be passed to the editor for currently
|
80
|
+
# This event is called by {Vedeu::Input::Input#capture}. When
|
81
|
+
# invoked, the key will be passed to the editor for currently
|
82
|
+
# focussed view.
|
82
83
|
#
|
83
84
|
# @example
|
84
85
|
# Vedeu.trigger(:_editor_, key)
|
@@ -99,7 +100,7 @@ module Vedeu
|
|
99
100
|
#
|
100
101
|
# @return [TrueClass]
|
101
102
|
def exit!
|
102
|
-
Vedeu.bind(:_exit_) { Vedeu::Application.stop }
|
103
|
+
Vedeu.bind(:_exit_) { Vedeu::Runtime::Application.stop }
|
103
104
|
end
|
104
105
|
|
105
106
|
# Vedeu triggers this event when it is ready to enter the main loop.
|
@@ -119,7 +120,7 @@ module Vedeu
|
|
119
120
|
# with the argument `:escape`, also an internal event `_mode_switch_` is
|
120
121
|
# triggered. Vedeu recognises most key presses and some 'extended'
|
121
122
|
# keypress (eg. Ctrl+J), a list of supported keypresses can be found here:
|
122
|
-
# {Vedeu::Input#specials} and {Vedeu::Input#f_keys}.
|
123
|
+
# {Vedeu::Input::Input#specials} and {Vedeu::Input::Input#f_keys}.
|
123
124
|
#
|
124
125
|
# @example
|
125
126
|
# Vedeu.trigger(:_keypress_, key)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
# Represents a {Vedeu::Terminal} view as a grid of
|
3
|
+
# Represents a {Vedeu::Terminal} view as a grid of
|
4
|
+
# {Vedeu::Models::Cell} objects.
|
4
5
|
#
|
5
6
|
class VirtualBuffer
|
6
7
|
|
@@ -27,8 +28,8 @@ module Vedeu
|
|
27
28
|
#
|
28
29
|
# @param height [Fixnum]
|
29
30
|
# @param width [Fixnum]
|
30
|
-
# @param renderer [Object|Vedeu::Renderers::HTML] An object
|
31
|
-
# .render.
|
31
|
+
# @param renderer [Object|Vedeu::Renderers::HTML] An object
|
32
|
+
# responding to .render.
|
32
33
|
# @return [Vedeu::VirtualBuffer]
|
33
34
|
def initialize(height, width, renderer = Vedeu::Renderers::HTML.new)
|
34
35
|
@height = height
|
@@ -36,8 +37,8 @@ module Vedeu
|
|
36
37
|
@renderer = renderer
|
37
38
|
end
|
38
39
|
|
39
|
-
# Return a grid of {Vedeu::Views::Char} objects defined by the
|
40
|
-
# width of this virtual terminal.
|
40
|
+
# Return a grid of {Vedeu::Views::Char} objects defined by the
|
41
|
+
# height and width of this virtual terminal.
|
41
42
|
#
|
42
43
|
# @return [Array<Array<Vedeu::Views::Char>>]
|
43
44
|
def cells
|
@@ -82,7 +83,8 @@ module Vedeu
|
|
82
83
|
renderer.render(cells)
|
83
84
|
end
|
84
85
|
|
85
|
-
# Removes all content from the virtual terminal; effectively
|
86
|
+
# Removes all content from the virtual terminal; effectively
|
87
|
+
# clearing it.
|
86
88
|
#
|
87
89
|
# @return [Array<Array<Vedeu::Views::Char>>]
|
88
90
|
def reset
|
@@ -101,7 +103,7 @@ module Vedeu
|
|
101
103
|
# @param data [Vedeu::Views::Char]
|
102
104
|
# @return [Vedeu::Views::Char]
|
103
105
|
def write(y, x, data)
|
104
|
-
return false unless read(y, x).is_a?(Vedeu::Cell)
|
106
|
+
return false unless read(y, x).is_a?(Vedeu::Models::Cell)
|
105
107
|
|
106
108
|
cy, cx = Vedeu::Geometry::Position[y, x].as_indices
|
107
109
|
cells[cy][cx] = data
|
@@ -112,17 +114,17 @@ module Vedeu
|
|
112
114
|
private
|
113
115
|
|
114
116
|
# @param from [Array] An Array of rows, or an Array of cells.
|
115
|
-
# @param which [Fixnum] A Fixnum representing the index; the row
|
116
|
-
# the cell number for a row.
|
117
|
+
# @param which [Fixnum] A Fixnum representing the index; the row
|
118
|
+
# number or the cell number for a row.
|
117
119
|
# @return [Array<Vedeu::Views::Char>|Array]
|
118
120
|
def fetch(from, which)
|
119
121
|
from[which] || []
|
120
122
|
end
|
121
123
|
|
122
|
-
# @return [Array<Array<Vedeu::Cell>>]
|
124
|
+
# @return [Array<Array<Vedeu::Models::Cell>>]
|
123
125
|
# @see Vedeu::VirtualBuffer#cells
|
124
126
|
def new_virtual_buffer
|
125
|
-
Array.new(height) { Array.new(width) { Vedeu::Cell.new } }
|
127
|
+
Array.new(height) { Array.new(width) { Vedeu::Models::Cell.new } }
|
126
128
|
end
|
127
129
|
|
128
130
|
end # VirtualBuffer
|
@@ -275,15 +275,16 @@ module Vedeu
|
|
275
275
|
options[:log] = filename
|
276
276
|
end
|
277
277
|
|
278
|
-
# Only log specific message types. A complete list of message
|
279
|
-
# be found at {Vedeu::Log.message_types}.
|
278
|
+
# Only log specific message types. A complete list of message
|
279
|
+
# types can be found at {Vedeu::Logging::Log.message_types}.
|
280
280
|
#
|
281
281
|
# Vedeu.configure do
|
282
282
|
# log_only :debug, :event
|
283
283
|
# # ...
|
284
284
|
# end
|
285
285
|
#
|
286
|
-
# @param types [Array<Symbol>] The message types which should be
|
286
|
+
# @param types [Array<Symbol>] The message types which should be
|
287
|
+
# slogged.
|
287
288
|
# @return [Array<Symbol>]
|
288
289
|
def log_only(*types)
|
289
290
|
options[:log_only] = types
|
data/lib/vedeu/cursors/cursor.rb
CHANGED
@@ -2,8 +2,8 @@ module Vedeu
|
|
2
2
|
|
3
3
|
module Cursors
|
4
4
|
|
5
|
-
# Each interface has its own Cursor which maintains the position
|
6
|
-
# visibility of the cursor within that interface.
|
5
|
+
# Each interface has its own Cursor which maintains the position
|
6
|
+
# and visibility of the cursor within that interface.
|
7
7
|
#
|
8
8
|
class Cursor
|
9
9
|
|
@@ -48,14 +48,17 @@ module Vedeu
|
|
48
48
|
# Returns a new instance of Vedeu::Cursors::Cursor.
|
49
49
|
#
|
50
50
|
# @param attributes [Hash]
|
51
|
-
# @option attributes name [String] The name of the interface
|
52
|
-
# belongs to.
|
51
|
+
# @option attributes name [String] The name of the interface
|
52
|
+
# this cursor belongs to.
|
53
53
|
# @option attributes ox [Fixnum] The offset x coordinate.
|
54
54
|
# @option attributes oy [Fixnum] The offset y coordinate.
|
55
55
|
# @option attributes repository [Vedeu::Repository]
|
56
|
-
# @option attributes visible [Boolean] The visibility of the
|
57
|
-
#
|
58
|
-
# @option attributes
|
56
|
+
# @option attributes visible [Boolean] The visibility of the
|
57
|
+
# cursor.
|
58
|
+
# @option attributes x [Fixnum] The terminal x coordinate for
|
59
|
+
# the cursor.
|
60
|
+
# @option attributes y [Fixnum] The terminal y coordinate for
|
61
|
+
# the cursor.
|
59
62
|
#
|
60
63
|
# @return [Vedeu::Cursors::Cursor]
|
61
64
|
def initialize(attributes = {})
|
@@ -133,7 +136,7 @@ module Vedeu
|
|
133
136
|
|
134
137
|
# Renders the cursor.
|
135
138
|
#
|
136
|
-
# @return [Array<Vedeu::Escape>]
|
139
|
+
# @return [Array<Vedeu::Models::Escape>]
|
137
140
|
def render
|
138
141
|
Vedeu::Output.render(visibility)
|
139
142
|
end
|
@@ -153,8 +156,8 @@ module Vedeu
|
|
153
156
|
end
|
154
157
|
|
155
158
|
# Returns an escape sequence to position the cursor and set its
|
156
|
-
# visibility. When passed a block, will position the cursor,
|
157
|
-
# return the original position.
|
159
|
+
# visibility. When passed a block, will position the cursor,
|
160
|
+
# yield and return the original position.
|
158
161
|
#
|
159
162
|
# @return [String]
|
160
163
|
def to_s
|
@@ -168,13 +171,14 @@ module Vedeu
|
|
168
171
|
end
|
169
172
|
alias_method :to_str, :to_s
|
170
173
|
|
171
|
-
# Hide a named cursor, or without a name, the cursor of the
|
174
|
+
# Hide a named cursor, or without a name, the cursor of the
|
175
|
+
# currently
|
172
176
|
# focussed interface.
|
173
177
|
#
|
174
178
|
# @example
|
175
179
|
# Vedeu.hide_cursor(name)
|
176
180
|
#
|
177
|
-
# @return [Vedeu::Escape]
|
181
|
+
# @return [Vedeu::Models::Escape]
|
178
182
|
def hide
|
179
183
|
super
|
180
184
|
|
@@ -200,13 +204,13 @@ module Vedeu
|
|
200
204
|
@position = Vedeu::Geometry::Position[y, x]
|
201
205
|
end
|
202
206
|
|
203
|
-
# Show a named cursor, or without a name, the cursor of the
|
204
|
-
# focussed interface.
|
207
|
+
# Show a named cursor, or without a name, the cursor of the
|
208
|
+
# currently focussed interface.
|
205
209
|
#
|
206
210
|
# @example
|
207
211
|
# Vedeu.show_cursor(name)
|
208
212
|
#
|
209
|
-
# @return [Vedeu::Escape]
|
213
|
+
# @return [Vedeu::Models::Escape]
|
210
214
|
def show
|
211
215
|
super
|
212
216
|
|
@@ -218,7 +222,7 @@ module Vedeu
|
|
218
222
|
# @example
|
219
223
|
# Vedeu.toggle_cursor(name)
|
220
224
|
#
|
221
|
-
# @return [Vedeu::Escape]
|
225
|
+
# @return [Vedeu::Models::Escape]
|
222
226
|
def toggle
|
223
227
|
if visible?
|
224
228
|
hide
|
@@ -276,13 +280,14 @@ module Vedeu
|
|
276
280
|
}
|
277
281
|
end
|
278
282
|
|
279
|
-
# Returns the escape sequence for setting the visibility of the
|
283
|
+
# Returns the escape sequence for setting the visibility of the
|
284
|
+
# cursor.
|
280
285
|
#
|
281
286
|
# @return [String]
|
282
287
|
def visibility
|
283
288
|
value = visible? ? Vedeu::Esc.show_cursor : Vedeu::Esc.hide_cursor
|
284
289
|
|
285
|
-
Vedeu::Escape.new(position: position, value: value)
|
290
|
+
Vedeu::Models::Escape.new(position: position, value: value)
|
286
291
|
end
|
287
292
|
|
288
293
|
end # Cursor
|
@@ -1,13 +1,16 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
# Provides a mechanism to control a running client application via
|
3
|
+
# Provides a mechanism to control a running client application via
|
4
|
+
# DRb.
|
4
5
|
#
|
5
6
|
module Distributed
|
6
7
|
|
7
|
-
# A class for the client side of the DRb server/client
|
8
|
+
# A class for the client side of the DRb server/client
|
9
|
+
# relationship.
|
8
10
|
#
|
9
11
|
# @example
|
10
|
-
# client = Vedeu::Distributed::Client.
|
12
|
+
# client = Vedeu::Distributed::Client.
|
13
|
+
# connect("druby://localhost:21420")
|
11
14
|
# client.input('a')
|
12
15
|
# client.output # => 'some content...'
|
13
16
|
class Client
|
@@ -25,7 +28,8 @@ module Vedeu
|
|
25
28
|
@uri = uri.to_s
|
26
29
|
end
|
27
30
|
|
28
|
-
# Simulate connecting to the DRb server by requesting its
|
31
|
+
# Simulate connecting to the DRb server by requesting its
|
32
|
+
# status.
|
29
33
|
#
|
30
34
|
# @return [Symbol]
|
31
35
|
def connect
|
@@ -67,8 +71,9 @@ module Vedeu
|
|
67
71
|
# Shutdown the DRb server and the client application.
|
68
72
|
#
|
69
73
|
# @note
|
70
|
-
# {Vedeu::Application} will raise StopIteration when
|
71
|
-
# is called. Here we rescue that to give a
|
74
|
+
# {Vedeu::Runtime::Application} will raise StopIteration when
|
75
|
+
# its `.stop` method is called. Here we rescue that to give a
|
76
|
+
# clean client exit.
|
72
77
|
#
|
73
78
|
# @return [void|Symbol]
|
74
79
|
def shutdown
|
@@ -62,9 +62,10 @@ module Vedeu
|
|
62
62
|
end # Eigenclass
|
63
63
|
|
64
64
|
# @param data [String|Symbol] The input to send to Vedeu.
|
65
|
-
# @param type [Symbol] Either :command or :keypress. Will
|
66
|
-
# respective capture mode within
|
67
|
-
# treat the data
|
65
|
+
# @param type [Symbol] Either :command or :keypress. Will
|
66
|
+
# trigger the respective capture mode within
|
67
|
+
# {Vedeu::Input::Input}, or if not given, will treat the data
|
68
|
+
# as a keypress.
|
68
69
|
# @return [void]
|
69
70
|
def input(data, type = :keypress)
|
70
71
|
Vedeu.trigger(:_drb_input_, data, type)
|
data/lib/vedeu/dsl/keymap.rb
CHANGED
@@ -48,18 +48,18 @@ module Vedeu
|
|
48
48
|
# to.
|
49
49
|
# @param block [Proc]
|
50
50
|
# @raise [Vedeu::Error::InvalidSyntax] The required block was not given.
|
51
|
-
# @return [Vedeu::Keymap]
|
51
|
+
# @return [Vedeu::Input::Keymap]
|
52
52
|
# @todo Try to remember why we need to pre-create the keymap in the
|
53
53
|
# repository.
|
54
54
|
def self.keymap(name, &block)
|
55
|
-
Vedeu::Keymap.new(name: name).store
|
55
|
+
Vedeu::Input::Keymap.new(name: name).store
|
56
56
|
|
57
|
-
Vedeu::Keymap.build(name: name, &block).store
|
57
|
+
Vedeu::Input::Keymap.build(name: name, &block).store
|
58
58
|
end
|
59
59
|
|
60
60
|
# Returns an instance of DSL::Keymap.
|
61
61
|
#
|
62
|
-
# @param model [Vedeu::Keymap]
|
62
|
+
# @param model [Vedeu::Input::Keymap]
|
63
63
|
# @param client [Object]
|
64
64
|
# @return [Vedeu::DSL::Keymap]
|
65
65
|
def initialize(model, client = nil)
|
@@ -71,8 +71,8 @@ module Vedeu
|
|
71
71
|
#
|
72
72
|
# @param value_or_values [Array<String>|Array<Symbol>|String|Symbol]
|
73
73
|
# The key(s) pressed. Special keys can be found in
|
74
|
-
# {Vedeu::Input#specials}. When more than one key is
|
75
|
-
# extras are treated as aliases.
|
74
|
+
# {Vedeu::Input::Input#specials}. When more than one key is
|
75
|
+
# defined, then the extras are treated as aliases.
|
76
76
|
# @param block [Proc] The action to perform when this key is pressed. Can
|
77
77
|
# be a method call or event triggered.
|
78
78
|
# @raise [Vedeu::Error::InvalidSyntax]
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# Provide a mechanism to edit individual lines of the view.
|
4
|
+
#
|
5
|
+
module Editor
|
6
|
+
|
7
|
+
end # Editor
|
8
|
+
|
9
|
+
end # Vedeu
|
10
|
+
|
11
|
+
require 'vedeu/editor/capture'
|
12
|
+
require 'vedeu/editor/cropper'
|
13
|
+
require 'vedeu/editor/editor'
|
14
|
+
require 'vedeu/editor/insert'
|
15
|
+
require 'vedeu/editor/line'
|
16
|
+
require 'vedeu/editor/lines'
|
17
|
+
require 'vedeu/editor/cursor'
|
18
|
+
require 'vedeu/editor/document'
|
19
|
+
require 'vedeu/editor/documents'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/vedeu/error.rb
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
# Custom exceptions/errors which Vedeu will raise in certain
|
3
|
+
# Custom exceptions/errors which Vedeu will raise in certain
|
4
|
+
# circumstances.
|
4
5
|
#
|
5
6
|
module Error
|
6
7
|
|
7
|
-
# Raised with Vedeu attempts to access a client application
|
8
|
-
# action that does not exist.
|
8
|
+
# Raised with Vedeu attempts to access a client application
|
9
|
+
# controller's action that does not exist.
|
9
10
|
#
|
10
11
|
class ActionNotFound < StandardError
|
11
12
|
|
12
13
|
end # ActionNotFound
|
13
14
|
|
14
|
-
# Raised with Vedeu attempts to access a client application
|
15
|
-
# does not exist.
|
15
|
+
# Raised with Vedeu attempts to access a client application
|
16
|
+
# controller that does not exist.
|
16
17
|
#
|
17
18
|
class ControllerNotFound < StandardError
|
18
19
|
|
@@ -26,43 +27,44 @@ module Vedeu
|
|
26
27
|
|
27
28
|
# Raised when Vedeu wishes to exit.
|
28
29
|
#
|
29
|
-
# @see Vedeu::MainLoop
|
30
|
+
# @see Vedeu::Runtime::MainLoop
|
30
31
|
#
|
31
32
|
class Interrupt < StandardError
|
32
33
|
|
33
34
|
end # Interrupt
|
34
35
|
|
35
|
-
# Raised when Vedeu attempts to parse a view or interface and
|
36
|
-
# problem.
|
36
|
+
# Raised when Vedeu attempts to parse a view or interface and
|
37
|
+
# encounters a problem.
|
37
38
|
#
|
38
39
|
class InvalidSyntax < StandardError
|
39
40
|
|
40
41
|
end # InvalidSyntax
|
41
42
|
|
42
|
-
# Raised when a name is not provided for a model when attempting
|
43
|
-
# in a repository.
|
43
|
+
# Raised when a name is not provided for a model when attempting
|
44
|
+
# to store it in a repository.
|
44
45
|
#
|
45
46
|
class MissingRequired < StandardError
|
46
47
|
|
47
48
|
end # MissingRequired
|
48
49
|
|
49
|
-
# Raised with Vedeu attempts to access a named model that does not
|
50
|
+
# Raised with Vedeu attempts to access a named model that does not
|
51
|
+
# exist.
|
50
52
|
#
|
51
53
|
class ModelNotFound < StandardError
|
52
54
|
|
53
55
|
end # ModelNotFound
|
54
56
|
|
55
|
-
# Raised intentionally when the client application wishes to
|
56
|
-
# cooked, fake and raw terminal modes.
|
57
|
+
# Raised intentionally when the client application wishes to
|
58
|
+
# switch between cooked, fake and raw terminal modes.
|
57
59
|
#
|
58
|
-
# @see Vedeu::Application
|
60
|
+
# @see Vedeu::Runtime::Application
|
59
61
|
#
|
60
62
|
class ModeSwitch < StandardError
|
61
63
|
|
62
64
|
end # ModeSwitch
|
63
65
|
|
64
|
-
# Raised to remind me (or client application developers) that the
|
65
|
-
# implements the functionality sought.
|
66
|
+
# Raised to remind me (or client application developers) that the
|
67
|
+
# subclass implements the functionality sought.
|
66
68
|
#
|
67
69
|
# @see Vedeu::Colours::Translator
|
68
70
|
#
|
@@ -70,8 +72,9 @@ module Vedeu
|
|
70
72
|
|
71
73
|
end # NotImplemented
|
72
74
|
|
73
|
-
# Raised when trying to access an interface column less than 1 or
|
74
|
-
# than 12. Vedeu is hard-wired to a 12-column layout for
|
75
|
+
# Raised when trying to access an interface column less than 1 or
|
76
|
+
# greater than 12. Vedeu is hard-wired to a 12-column layout for
|
77
|
+
# the time being.
|
75
78
|
#
|
76
79
|
# @see Vedeu::Geometry::Grid
|
77
80
|
#
|
data/lib/vedeu/esc/borders.rb
CHANGED
@@ -7,11 +7,13 @@ module Vedeu
|
|
7
7
|
# Provides border/box related escape sequences.
|
8
8
|
#
|
9
9
|
# @note
|
10
|
-
# Refer to UTF-8 U+2500 to U+257F for border characters. More
|
11
|
-
# be found at:
|
10
|
+
# Refer to UTF-8 U+2500 to U+257F for border characters. More
|
11
|
+
# details can be found at:
|
12
12
|
#
|
13
|
-
#
|
14
|
-
#
|
13
|
+
# http://en.wikipedia.org/wiki/Box-drawing_character
|
14
|
+
#
|
15
|
+
# Using the '\uXXXX' variant produces gaps in the border, whilst
|
16
|
+
# the '\xXX' renders 'nicely'.
|
15
17
|
#
|
16
18
|
module Borders
|
17
19
|
|