vedeu 0.6.25 → 0.6.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu/application/application_view.rb +2 -2
- data/lib/vedeu/bindings/drb.rb +1 -1
- data/lib/vedeu/bindings/movement.rb +4 -4
- data/lib/vedeu/borders/border.rb +5 -13
- data/lib/vedeu/borders/refresh.rb +4 -1
- data/lib/vedeu/buffers/buffer.rb +1 -1
- data/lib/vedeu/colours/background.rb +2 -2
- data/lib/vedeu/colours/foreground.rb +2 -2
- data/lib/vedeu/colours/translator.rb +4 -4
- data/lib/vedeu/configuration/api.rb +1 -1
- data/lib/vedeu/configuration/configuration.rb +1 -1
- data/lib/vedeu/cursors/cursor.rb +2 -2
- data/lib/vedeu/distributed/client.rb +3 -3
- data/lib/vedeu/distributed/server.rb +16 -15
- data/lib/vedeu/distributed/subprocess.rb +2 -2
- data/lib/vedeu/distributed/uri.rb +1 -1
- data/lib/vedeu/dsl/composition.rb +3 -2
- data/lib/vedeu/dsl/dsl.rb +2 -1
- data/lib/vedeu/dsl/interface.rb +1 -1
- data/lib/vedeu/dsl/keymap.rb +3 -3
- data/lib/vedeu/editor/cropper.rb +1 -1
- data/lib/vedeu/editor/cursor.rb +1 -1
- data/lib/vedeu/editor/line.rb +1 -1
- data/lib/vedeu/error.rb +2 -2
- data/lib/vedeu/esc/actions.rb +15 -15
- data/lib/vedeu/esc/borders.rb +12 -12
- data/lib/vedeu/esc/colours.rb +10 -8
- data/lib/vedeu/esc/esc.rb +10 -9
- data/lib/vedeu/events/aliases.rb +1 -4
- data/lib/vedeu/events/event.rb +5 -4
- data/lib/vedeu/geometry/generic_coordinate.rb +1 -1
- data/lib/vedeu/geometry/geometry.rb +2 -4
- data/lib/vedeu/geometry/position.rb +2 -2
- data/lib/vedeu/groups/refresh.rb +2 -2
- data/lib/vedeu/input/keymap.rb +3 -2
- data/lib/vedeu/input/mapper.rb +1 -1
- data/lib/vedeu/logging/lockless_log_device.rb +1 -1
- data/lib/vedeu/logging/log.rb +2 -2
- data/lib/vedeu/logging/mono_logger.rb +1 -1
- data/lib/vedeu/logging/timer.rb +2 -1
- data/lib/vedeu/models/escape.rb +2 -2
- data/lib/vedeu/models/focus.rb +5 -3
- data/lib/vedeu/models/page.rb +2 -2
- data/lib/vedeu/models/views/html_char.rb +15 -14
- data/lib/vedeu/models/views/view.rb +2 -1
- data/lib/vedeu/output/clear/interface.rb +4 -4
- data/lib/vedeu/output/compressor.rb +3 -3
- data/lib/vedeu/output/presentation/presentation.rb +2 -2
- data/lib/vedeu/output/presentation/style.rb +1 -1
- data/lib/vedeu/output/refresh/refresh.rb +1 -1
- data/lib/vedeu/output/renderers/all.rb +2 -0
- data/lib/vedeu/output/renderers/file.rb +1 -1
- data/lib/vedeu/output/viewport.rb +1 -1
- data/lib/vedeu/output/wordwrap.rb +4 -4
- data/lib/vedeu/plugins/plugin.rb +3 -3
- data/lib/vedeu/plugins/plugins.rb +4 -3
- data/lib/vedeu/repositories/model.rb +6 -6
- data/lib/vedeu/repositories/repositories.rb +1 -1
- data/lib/vedeu/repositories/repository.rb +11 -10
- data/lib/vedeu/repositories/store.rb +1 -1
- data/lib/vedeu/runtime/bootstrap.rb +8 -8
- data/lib/vedeu/runtime/launcher.rb +1 -1
- data/lib/vedeu/runtime/main_loop.rb +1 -1
- data/lib/vedeu/runtime/router.rb +10 -8
- data/lib/vedeu/templating/template.rb +2 -2
- data/lib/vedeu/terminal/buffer.rb +10 -11
- data/lib/vedeu/terminal/terminal.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/border_test.rb +1 -11
- data/test/lib/vedeu/colours/repository_test.rb +2 -1
- data/test/lib/vedeu/esc/colours_test.rb +50 -0
- data/test/lib/vedeu/repositories/repository_test.rb +0 -2
- data/test/lib/vedeu/terminal/buffer_test.rb +0 -209
- metadata +2 -2
data/lib/vedeu/dsl/keymap.rb
CHANGED
@@ -73,15 +73,15 @@ module Vedeu
|
|
73
73
|
# @return [Array] A collection containing the keypress(es).
|
74
74
|
def key(*values, &block)
|
75
75
|
fail Vedeu::Error::InvalidSyntax,
|
76
|
-
'No action defined for `key`.' unless block_given?
|
76
|
+
'No action defined for `key`.'.freeze unless block_given?
|
77
77
|
|
78
78
|
fail Vedeu::Error::InvalidSyntax,
|
79
|
-
'No keypress(es) defined for `key`.' unless present?(values)
|
79
|
+
'No keypress(es) defined for `key`.'.freeze unless present?(values)
|
80
80
|
|
81
81
|
values.each do |value|
|
82
82
|
unless present?(value)
|
83
83
|
fail Vedeu::Error::InvalidSyntax,
|
84
|
-
'An invalid value for `key` was encountered.'
|
84
|
+
'An invalid value for `key` was encountered.'.freeze
|
85
85
|
end
|
86
86
|
|
87
87
|
model.add(model.member.new(value, &block))
|
data/lib/vedeu/editor/cropper.rb
CHANGED
data/lib/vedeu/editor/cursor.rb
CHANGED
data/lib/vedeu/editor/line.rb
CHANGED
data/lib/vedeu/error.rb
CHANGED
@@ -82,7 +82,7 @@ module Vedeu
|
|
82
82
|
|
83
83
|
# @return [String]
|
84
84
|
def message
|
85
|
-
'Valid value is between 1 and 12 inclusive.'
|
85
|
+
'Valid value is between 1 and 12 inclusive.'.freeze
|
86
86
|
end
|
87
87
|
|
88
88
|
end # OutOfRange
|
@@ -94,7 +94,7 @@ module Vedeu
|
|
94
94
|
|
95
95
|
# @return [String]
|
96
96
|
def message
|
97
|
-
'The required block was not given.'
|
97
|
+
'The required block was not given.'.freeze
|
98
98
|
end
|
99
99
|
|
100
100
|
end
|
data/lib/vedeu/esc/actions.rb
CHANGED
@@ -11,21 +11,21 @@ module Vedeu
|
|
11
11
|
# @return [Hash<Symbol => String>]
|
12
12
|
def characters
|
13
13
|
{
|
14
|
-
hide_cursor: "\e[?25l",
|
15
|
-
show_cursor: "\e[?25h",
|
16
|
-
cursor_position: "\e[6n",
|
17
|
-
bg_reset: "\e[49m",
|
18
|
-
blink: "\e[5m",
|
19
|
-
blink_off: "\e[25m",
|
20
|
-
bold: "\e[1m",
|
21
|
-
bold_off: "\e[22m",
|
22
|
-
dim: "\e[2m",
|
23
|
-
fg_reset: "\e[39m",
|
24
|
-
negative: "\e[7m",
|
25
|
-
positive: "\e[27m",
|
26
|
-
reset: "\e[0m",
|
27
|
-
underline: "\e[4m",
|
28
|
-
underline_off: "\e[24m",
|
14
|
+
hide_cursor: "\e[?25l".freeze,
|
15
|
+
show_cursor: "\e[?25h".freeze,
|
16
|
+
cursor_position: "\e[6n".freeze,
|
17
|
+
bg_reset: "\e[49m".freeze,
|
18
|
+
blink: "\e[5m".freeze,
|
19
|
+
blink_off: "\e[25m".freeze,
|
20
|
+
bold: "\e[1m".freeze,
|
21
|
+
bold_off: "\e[22m".freeze,
|
22
|
+
dim: "\e[2m".freeze,
|
23
|
+
fg_reset: "\e[39m".freeze,
|
24
|
+
negative: "\e[7m".freeze,
|
25
|
+
positive: "\e[27m".freeze,
|
26
|
+
reset: "\e[0m".freeze,
|
27
|
+
underline: "\e[4m".freeze,
|
28
|
+
underline_off: "\e[24m".freeze,
|
29
29
|
}
|
30
30
|
end
|
31
31
|
|
data/lib/vedeu/esc/borders.rb
CHANGED
@@ -19,12 +19,12 @@ module Vedeu
|
|
19
19
|
|
20
20
|
# @return [String]
|
21
21
|
def border_on
|
22
|
-
"\e(0"
|
22
|
+
"\e(0".freeze
|
23
23
|
end
|
24
24
|
|
25
25
|
# @return [String]
|
26
26
|
def border_off
|
27
|
-
"\e(B"
|
27
|
+
"\e(B".freeze
|
28
28
|
end
|
29
29
|
|
30
30
|
# Provides all the semigraphic characters.
|
@@ -36,16 +36,16 @@ module Vedeu
|
|
36
36
|
# @return [Hash<Symbol => String>]
|
37
37
|
def characters
|
38
38
|
{
|
39
|
-
bottom_right: "\x6A", # ┘ # \u2518
|
40
|
-
top_right: "\x6B", # ┐ # \u2510
|
41
|
-
top_left: "\x6C", # ┌ # \u250C
|
42
|
-
bottom_left: "\x6D", # └ # \u2514
|
43
|
-
horizontal: "\x71", # ─ # \u2500
|
44
|
-
vertical_left: "\x74", # ├ # \u251C
|
45
|
-
vertical_right: "\x75", # ┤ # \u2524
|
46
|
-
horizontal_bottom: "\x76", # ┴ # \u2534
|
47
|
-
horizontal_top: "\x77", # ┬ # \u252C
|
48
|
-
vertical: "\x78", # │ # \u2502
|
39
|
+
bottom_right: "\x6A".freeze, # ┘ # \u2518
|
40
|
+
top_right: "\x6B".freeze, # ┐ # \u2510
|
41
|
+
top_left: "\x6C".freeze, # ┌ # \u250C
|
42
|
+
bottom_left: "\x6D".freeze, # └ # \u2514
|
43
|
+
horizontal: "\x71".freeze, # ─ # \u2500
|
44
|
+
vertical_left: "\x74".freeze, # ├ # \u251C
|
45
|
+
vertical_right: "\x75".freeze, # ┤ # \u2524
|
46
|
+
horizontal_bottom: "\x76".freeze, # ┴ # \u2534
|
47
|
+
horizontal_top: "\x77".freeze, # ┬ # \u252C
|
48
|
+
vertical: "\x78".freeze, # │ # \u2502
|
49
49
|
}
|
50
50
|
end
|
51
51
|
|
data/lib/vedeu/esc/colours.rb
CHANGED
@@ -13,10 +13,10 @@ module Vedeu
|
|
13
13
|
#
|
14
14
|
# @return [Hash<Symbol => Fixnum>]
|
15
15
|
def background_codes
|
16
|
-
|
17
|
-
|
18
|
-
h
|
19
|
-
end
|
16
|
+
foreground_codes.each_with_object({}) do |(k, v), h|
|
17
|
+
h[k] = v + 10
|
18
|
+
h
|
19
|
+
end.freeze
|
20
20
|
end
|
21
21
|
|
22
22
|
# Produces the foreground named colour escape sequence hash. The
|
@@ -64,7 +64,7 @@ module Vedeu
|
|
64
64
|
light_magenta: 95,
|
65
65
|
light_cyan: 96,
|
66
66
|
white: 97,
|
67
|
-
}
|
67
|
+
}.freeze
|
68
68
|
end
|
69
69
|
alias_method :codes, :foreground_codes
|
70
70
|
|
@@ -79,8 +79,9 @@ module Vedeu
|
|
79
79
|
# @return [void]
|
80
80
|
def define_backgrounds!
|
81
81
|
background_codes.each do |key, code|
|
82
|
-
define_method("on_#{key}") do |&blk|
|
83
|
-
"\e[#{code}m"
|
82
|
+
define_method(:"on_#{key}") do |&blk|
|
83
|
+
"\e[#{code}m".freeze +
|
84
|
+
(blk ? blk.call + "\e[49m".freeze : ''.freeze)
|
84
85
|
end
|
85
86
|
end
|
86
87
|
end
|
@@ -93,7 +94,8 @@ module Vedeu
|
|
93
94
|
def define_foregrounds!
|
94
95
|
foreground_codes.each do |key, code|
|
95
96
|
define_method(key) do |&blk|
|
96
|
-
"\e[#{code}m"
|
97
|
+
"\e[#{code}m".freeze +
|
98
|
+
(blk ? blk.call + "\e[39m".freeze : ''.freeze)
|
97
99
|
end
|
98
100
|
end
|
99
101
|
end
|
data/lib/vedeu/esc/esc.rb
CHANGED
@@ -38,11 +38,11 @@ module Vedeu
|
|
38
38
|
# @param value [String|Symbol]
|
39
39
|
# @return [String]
|
40
40
|
def string(value = '')
|
41
|
-
return '' if value.empty?
|
41
|
+
return ''.freeze if value.empty?
|
42
42
|
|
43
43
|
send(value)
|
44
44
|
rescue NoMethodError
|
45
|
-
''
|
45
|
+
''.freeze
|
46
46
|
end
|
47
47
|
|
48
48
|
# Return the escape sequence to render a border character.
|
@@ -53,39 +53,40 @@ module Vedeu
|
|
53
53
|
def border
|
54
54
|
return '' unless block_given?
|
55
55
|
|
56
|
-
"#{border_on}#{yield}#{border_off}"
|
56
|
+
"#{border_on}#{yield}#{border_off}".freeze
|
57
57
|
end
|
58
58
|
|
59
59
|
private
|
60
60
|
|
61
61
|
# @return [String]
|
62
62
|
def clear
|
63
|
-
"#{colour_reset}\e[2J"
|
63
|
+
"#{colour_reset}\e[2J".freeze
|
64
64
|
end
|
65
65
|
|
66
66
|
# @return [String]
|
67
67
|
def clear_line
|
68
|
-
"#{colour_reset}\e[2K"
|
68
|
+
"#{colour_reset}\e[2K".freeze
|
69
69
|
end
|
70
70
|
|
71
71
|
# @return [String]
|
72
72
|
def colour_reset
|
73
|
-
"#{fg_reset}#{bg_reset}"
|
73
|
+
"#{fg_reset}#{bg_reset}".freeze
|
74
74
|
end
|
75
75
|
|
76
76
|
# @return [String]
|
77
77
|
def normal
|
78
|
-
"#{underline_off}#{bold_off}#{positive}"
|
78
|
+
"#{underline_off}#{bold_off}#{positive}".freeze
|
79
79
|
end
|
80
80
|
|
81
81
|
# @return [String]
|
82
82
|
def screen_init
|
83
|
-
"#{reset}#{clear}#{hide_cursor}"
|
83
|
+
"#{reset}#{clear}#{hide_cursor}".freeze
|
84
84
|
end
|
85
85
|
|
86
86
|
# @return [String]
|
87
87
|
def screen_exit
|
88
|
-
"#{show_cursor}#{colour_reset}#{reset}
|
88
|
+
"#{show_cursor}#{colour_reset}#{reset}" \
|
89
|
+
"#{last_character_position}\n".freeze
|
89
90
|
end
|
90
91
|
|
91
92
|
# @return [String]
|
data/lib/vedeu/events/aliases.rb
CHANGED
@@ -5,9 +5,6 @@ module Vedeu
|
|
5
5
|
# Allows the storing of event aliases. Each alias can contain
|
6
6
|
# multiple event names.
|
7
7
|
#
|
8
|
-
# @note
|
9
|
-
#
|
10
|
-
#
|
11
8
|
module Aliases
|
12
9
|
|
13
10
|
include Vedeu::Common
|
@@ -91,7 +88,7 @@ module Vedeu
|
|
91
88
|
return [] unless registered?(alias_name)
|
92
89
|
|
93
90
|
find(alias_name).map do |event_name|
|
94
|
-
Vedeu.log(type: :debug, message: "#{event_name}")
|
91
|
+
Vedeu.log(type: :debug, message: "#{event_name}".freeze)
|
95
92
|
Vedeu::Events::Trigger.trigger(event_name, *args)
|
96
93
|
end
|
97
94
|
end
|
data/lib/vedeu/events/event.rb
CHANGED
@@ -84,7 +84,7 @@ module Vedeu
|
|
84
84
|
#
|
85
85
|
# @return [TrueClass]
|
86
86
|
def bind(name, options = {}, &block)
|
87
|
-
Vedeu.log(type: :event, message: "Binding: '#{name.inspect}'")
|
87
|
+
Vedeu.log(type: :event, message: "Binding: '#{name.inspect}'".freeze)
|
88
88
|
|
89
89
|
new(name, block, options).bind
|
90
90
|
end
|
@@ -116,7 +116,8 @@ module Vedeu
|
|
116
116
|
def unbind(name)
|
117
117
|
return false unless Vedeu.bound?(name)
|
118
118
|
|
119
|
-
Vedeu.log(type:
|
119
|
+
Vedeu.log(type: :event,
|
120
|
+
message: "Unbinding: '#{name.inspect}'".freeze)
|
120
121
|
|
121
122
|
Vedeu.events.remove(name)
|
122
123
|
|
@@ -217,7 +218,7 @@ module Vedeu
|
|
217
218
|
def throttle_expired?
|
218
219
|
return true if (@now - @executed_at) > delay
|
219
220
|
|
220
|
-
Vedeu.log(type: :event, message: "Throttling: '#{name.inspect}'")
|
221
|
+
Vedeu.log(type: :event, message: "Throttling: '#{name.inspect}'".freeze)
|
221
222
|
|
222
223
|
false
|
223
224
|
end
|
@@ -244,7 +245,7 @@ module Vedeu
|
|
244
245
|
def debounce_expired?
|
245
246
|
return true if (@executed_at = @now) > @deadline
|
246
247
|
|
247
|
-
Vedeu.log(type: :event, message: "Debouncing: '#{name.inspect}'")
|
248
|
+
Vedeu.log(type: :event, message: "Debouncing: '#{name.inspect}'".freeze)
|
248
249
|
|
249
250
|
false
|
250
251
|
end
|
@@ -119,11 +119,10 @@ module Vedeu
|
|
119
119
|
def maximise
|
120
120
|
return self if maximised?
|
121
121
|
|
122
|
-
Vedeu.trigger(:_clear_)
|
123
|
-
|
124
122
|
@maximised = true
|
125
123
|
|
126
124
|
store do
|
125
|
+
Vedeu.trigger(:_clear_)
|
127
126
|
Vedeu.trigger(:_refresh_view_, name)
|
128
127
|
end
|
129
128
|
end
|
@@ -190,11 +189,10 @@ module Vedeu
|
|
190
189
|
def unmaximise
|
191
190
|
return self unless maximised?
|
192
191
|
|
193
|
-
Vedeu.trigger(:_clear_)
|
194
|
-
|
195
192
|
@maximised = false
|
196
193
|
|
197
194
|
store do
|
195
|
+
Vedeu.trigger(:_clear_)
|
198
196
|
Vedeu.trigger(:_refresh_)
|
199
197
|
end
|
200
198
|
end
|
@@ -102,7 +102,7 @@ module Vedeu
|
|
102
102
|
# @yieldreturn [String] Returns the block wrapped in position
|
103
103
|
# escape sequences.
|
104
104
|
def to_s
|
105
|
-
return "#{sequence}#{yield}" if block_given?
|
105
|
+
return "#{sequence}#{yield}".freeze if block_given?
|
106
106
|
|
107
107
|
sequence
|
108
108
|
end
|
@@ -143,7 +143,7 @@ module Vedeu
|
|
143
143
|
#
|
144
144
|
# @return [String]
|
145
145
|
def sequence
|
146
|
-
"\e[#{y};#{x}H"
|
146
|
+
"\e[#{y};#{x}H".freeze
|
147
147
|
end
|
148
148
|
|
149
149
|
end # Position
|
data/lib/vedeu/groups/refresh.rb
CHANGED
@@ -35,7 +35,7 @@ module Vedeu
|
|
35
35
|
|
36
36
|
# @return [void]
|
37
37
|
def by_name
|
38
|
-
Vedeu.timer("Refresh Group: '#{group_name}'") do
|
38
|
+
Vedeu.timer("Refresh Group: '#{group_name}'".freeze) do
|
39
39
|
Vedeu.groups.by_name(group_name).by_zindex.each do |name|
|
40
40
|
Vedeu.trigger(:_refresh_view_, name)
|
41
41
|
end
|
@@ -57,7 +57,7 @@ module Vedeu
|
|
57
57
|
return name if present?(name)
|
58
58
|
|
59
59
|
fail Vedeu::Error::MissingRequired,
|
60
|
-
'Cannot refresh group with an empty group name.'
|
60
|
+
'Cannot refresh group with an empty group name.'.freeze
|
61
61
|
end
|
62
62
|
|
63
63
|
end # Refresh
|
data/lib/vedeu/input/keymap.rb
CHANGED
@@ -66,7 +66,7 @@ module Vedeu
|
|
66
66
|
def use(input)
|
67
67
|
return false unless key_defined?(input)
|
68
68
|
|
69
|
-
Vedeu.log(type: :input, message: "Key pressed: '#{input}'")
|
69
|
+
Vedeu.log(type: :input, message: "Key pressed: '#{input}'".freeze)
|
70
70
|
|
71
71
|
Vedeu.trigger(:key, input)
|
72
72
|
|
@@ -95,7 +95,8 @@ module Vedeu
|
|
95
95
|
return true unless key_defined?(key.input)
|
96
96
|
|
97
97
|
Vedeu.log(type: :input,
|
98
|
-
message: "Keymap '#{name}' already
|
98
|
+
message: "Keymap '#{name}' already " \
|
99
|
+
"defines '#{key.input}'.".freeze)
|
99
100
|
|
100
101
|
false
|
101
102
|
end
|
data/lib/vedeu/input/mapper.rb
CHANGED
data/lib/vedeu/logging/log.rb
CHANGED
@@ -73,7 +73,7 @@ module Vedeu
|
|
73
73
|
# coloured and combined.
|
74
74
|
# @return [String]
|
75
75
|
def formatted_message(message)
|
76
|
-
"#{timestamp}#{message}\n" if message
|
76
|
+
"#{timestamp}#{message}\n".freeze if message
|
77
77
|
end
|
78
78
|
|
79
79
|
# Returns the message:
|
@@ -85,7 +85,7 @@ module Vedeu
|
|
85
85
|
# log file, useful for debugging.
|
86
86
|
# @return [String]
|
87
87
|
def log_entry(type, message)
|
88
|
-
"#{message_type(type)}#{message_body(type, message)}"
|
88
|
+
"#{message_type(type)}#{message_body(type, message)}".freeze
|
89
89
|
end
|
90
90
|
|
91
91
|
# Fetches the filename from the configuration.
|
@@ -12,7 +12,7 @@ module Vedeu
|
|
12
12
|
# (typically STDOUT, STDERR or an open file).
|
13
13
|
# @return [Vedeu::Logging::MonoLogger]
|
14
14
|
def initialize(logdev)
|
15
|
-
@progname = 'Vedeu'
|
15
|
+
@progname = 'Vedeu'.freeze
|
16
16
|
@level = Logger::DEBUG
|
17
17
|
@default_formatter = Logger::Formatter.new
|
18
18
|
@formatter = nil
|