vedeu 0.4.11 → 0.4.12
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 +736 -0
- data/Rakefile +7 -0
- data/bin/vedeu_drb_server +1 -1
- data/config/rubocop_disabled.yml +50 -0
- data/config/rubocop_enabled.yml +1044 -0
- data/examples/borders_app.rb +3 -1
- data/examples/colours_app.rb +3 -1
- data/examples/configuration_app.rb +1 -1
- data/examples/cursor_app.rb +4 -1
- data/examples/drb_app.rb +3 -1
- data/examples/focus_app.rb +1 -1
- data/examples/geometry_app.rb +3 -1
- data/examples/hello_world.rb +3 -1
- data/examples/lines_app.rb +3 -1
- data/examples/typed_commands/typed_commands_app.rb +1 -1
- data/examples/view_templates_app/view_templates_app.rb +3 -1
- data/lib/vedeu/api.rb +4 -3
- data/lib/vedeu/bindings.rb +1 -1
- data/lib/vedeu/configuration/api.rb +1 -1
- data/lib/vedeu/configuration/cli.rb +3 -2
- data/lib/vedeu/configuration/configuration.rb +1 -1
- data/lib/vedeu/cursor/cursor.rb +2 -2
- data/lib/vedeu/cursor/refresh_cursor.rb +3 -1
- data/lib/vedeu/distributed/templates/default_configuration.vedeu +1 -1
- data/lib/vedeu/events/event.rb +3 -5
- data/lib/vedeu/geometry/position.rb +1 -1
- data/lib/vedeu/input/all.rb +1 -1
- data/lib/vedeu/input/key.rb +5 -8
- data/lib/vedeu/models/all.rb +9 -12
- data/lib/vedeu/models/interface.rb +1 -1
- data/lib/vedeu/models/menu.rb +1 -1
- data/lib/vedeu/output/border.rb +18 -14
- data/lib/vedeu/output/clear.rb +10 -3
- data/lib/vedeu/output/esc.rb +4 -14
- data/lib/vedeu/output/html_char.rb +11 -7
- data/lib/vedeu/output/null_border.rb +10 -0
- data/lib/vedeu/output/presentation.rb +6 -22
- data/lib/vedeu/output/refresh.rb +0 -11
- data/lib/vedeu/output/renderers/terminal_renderer.rb +1 -1
- data/lib/vedeu/output/translator.rb +5 -5
- data/lib/vedeu/output/viewport.rb +12 -9
- data/lib/vedeu/repositories/collections.rb +6 -0
- data/lib/vedeu/support/visible.rb +17 -12
- data/lib/vedeu/traps.rb +3 -3
- data/test/lib/vedeu/configuration/cli_test.rb +1 -1
- data/test/lib/vedeu/output/null_border_test.rb +14 -0
- data/test/lib/vedeu/output/refresh_test.rb +0 -21
- data/test/lib/vedeu/support/coercions_test.rb +5 -5
- data/test/lib/vedeu/support/common_test.rb +1 -1
- data/test/lib/vedeu/support/visible_test.rb +10 -5
- data/test/test_helper.rb +2 -2
- data/vedeu.gemspec +3 -2
- metadata +22 -5
data/examples/borders_app.rb
CHANGED
|
@@ -5,11 +5,13 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
|
5
5
|
|
|
6
6
|
require 'vedeu'
|
|
7
7
|
|
|
8
|
+
# An example application to demonstrate borders.
|
|
9
|
+
#
|
|
8
10
|
class VedeuBordersApp
|
|
9
11
|
include Vedeu
|
|
10
12
|
|
|
11
13
|
configure do
|
|
12
|
-
colour_mode
|
|
14
|
+
colour_mode 16_777_216
|
|
13
15
|
debug!
|
|
14
16
|
log '/tmp/vedeu_borders_app.log'
|
|
15
17
|
end
|
data/examples/colours_app.rb
CHANGED
|
@@ -5,11 +5,13 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
|
5
5
|
|
|
6
6
|
require 'vedeu'
|
|
7
7
|
|
|
8
|
+
# An example application to demonstrate colours.
|
|
9
|
+
#
|
|
8
10
|
class VedeuColoursApp
|
|
9
11
|
include Vedeu
|
|
10
12
|
|
|
11
13
|
configure do
|
|
12
|
-
colour_mode
|
|
14
|
+
colour_mode 16_777_216
|
|
13
15
|
debug!
|
|
14
16
|
log '/tmp/vedeu_colours_app.log'
|
|
15
17
|
end
|
data/examples/cursor_app.rb
CHANGED
|
@@ -5,11 +5,14 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
|
5
5
|
|
|
6
6
|
require 'vedeu'
|
|
7
7
|
|
|
8
|
+
# An example application to demonstrate cursors; their movement and effect on
|
|
9
|
+
# the viewport of the interface in focus.
|
|
10
|
+
#
|
|
8
11
|
class VedeuCursorApp
|
|
9
12
|
include Vedeu
|
|
10
13
|
|
|
11
14
|
configure do
|
|
12
|
-
colour_mode
|
|
15
|
+
colour_mode 16_777_216
|
|
13
16
|
debug!
|
|
14
17
|
log '/tmp/vedeu_cursor_app.log'
|
|
15
18
|
end
|
data/examples/drb_app.rb
CHANGED
|
@@ -5,11 +5,13 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
|
5
5
|
|
|
6
6
|
require 'vedeu'
|
|
7
7
|
|
|
8
|
+
# An example application to demonstrate the DRb server.
|
|
9
|
+
#
|
|
8
10
|
class VedeuTestApplication
|
|
9
11
|
# include Vedeu
|
|
10
12
|
|
|
11
13
|
Vedeu.configure do
|
|
12
|
-
colour_mode
|
|
14
|
+
colour_mode 16_777_216
|
|
13
15
|
log '/tmp/vedeu_test_helper.log'
|
|
14
16
|
debug!
|
|
15
17
|
drb!
|
data/examples/focus_app.rb
CHANGED
data/examples/geometry_app.rb
CHANGED
|
@@ -5,11 +5,13 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
|
5
5
|
|
|
6
6
|
require 'vedeu'
|
|
7
7
|
|
|
8
|
+
# An example application to demonstrate geometry.
|
|
9
|
+
#
|
|
8
10
|
class VedeuGeometryApp
|
|
9
11
|
include Vedeu
|
|
10
12
|
|
|
11
13
|
configure do
|
|
12
|
-
colour_mode
|
|
14
|
+
colour_mode 16_777_216
|
|
13
15
|
debug!
|
|
14
16
|
log '/tmp/vedeu_geometry_app.log'
|
|
15
17
|
end
|
data/examples/hello_world.rb
CHANGED
|
@@ -8,11 +8,13 @@ trap('INT') { exit! }
|
|
|
8
8
|
# require 'bundler/setup' # uncomment to remove the need to do `bundle exec`.
|
|
9
9
|
require 'vedeu'
|
|
10
10
|
|
|
11
|
+
# An example application to demonstrate 'Hello World'.
|
|
12
|
+
#
|
|
11
13
|
class HelloWorldApp
|
|
12
14
|
include Vedeu
|
|
13
15
|
|
|
14
16
|
configure do
|
|
15
|
-
colour_mode
|
|
17
|
+
colour_mode 16_777_216
|
|
16
18
|
debug!
|
|
17
19
|
log '/tmp/vedeu_hello_world.log'
|
|
18
20
|
end
|
data/examples/lines_app.rb
CHANGED
|
@@ -5,11 +5,13 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
|
5
5
|
|
|
6
6
|
require 'vedeu'
|
|
7
7
|
|
|
8
|
+
# An example application to demonstrate interface lines.
|
|
9
|
+
#
|
|
8
10
|
class VedeuLinesApp
|
|
9
11
|
include Vedeu
|
|
10
12
|
|
|
11
13
|
configure do
|
|
12
|
-
colour_mode
|
|
14
|
+
colour_mode 16_777_216
|
|
13
15
|
debug!
|
|
14
16
|
log '/tmp/vedeu_lines_app.log'
|
|
15
17
|
end
|
|
@@ -5,11 +5,13 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
|
5
5
|
|
|
6
6
|
require 'vedeu'
|
|
7
7
|
|
|
8
|
+
# An example application to demonstrate templates.
|
|
9
|
+
#
|
|
8
10
|
class VedeuViewTemplateApp
|
|
9
11
|
include Vedeu
|
|
10
12
|
|
|
11
13
|
configure do
|
|
12
|
-
colour_mode
|
|
14
|
+
colour_mode 16_777_216
|
|
13
15
|
debug!
|
|
14
16
|
log '/tmp/vedeu_view_templates_app.log'
|
|
15
17
|
end
|
data/lib/vedeu/api.rb
CHANGED
|
@@ -92,14 +92,15 @@ module Vedeu
|
|
|
92
92
|
|
|
93
93
|
# @!method bind
|
|
94
94
|
# @see Vedeu::Event.bind
|
|
95
|
-
# @!method trigger
|
|
96
|
-
# @see Vedeu::Event.trigger
|
|
97
95
|
# @!method unbind
|
|
98
96
|
# @see Vedeu::Event.unbind
|
|
99
97
|
def_delegators Vedeu::Event, :bind,
|
|
100
|
-
:trigger,
|
|
101
98
|
:unbind
|
|
102
99
|
|
|
100
|
+
# @!method trigger
|
|
101
|
+
# @see Vedeu::Trigger.trigger
|
|
102
|
+
def_delegators Vedeu::Trigger, :trigger
|
|
103
|
+
|
|
103
104
|
# @!method configure
|
|
104
105
|
# @see Vedeu::Configuration.configure
|
|
105
106
|
# @!method configuration
|
data/lib/vedeu/bindings.rb
CHANGED
|
@@ -195,7 +195,7 @@ module Vedeu
|
|
|
195
195
|
|
|
196
196
|
# Will cause the named cursor to refresh, or the cursor of the interface
|
|
197
197
|
# which is currently in focus.
|
|
198
|
-
Vedeu.bind(:_refresh_cursor_) { |name| Vedeu::
|
|
198
|
+
Vedeu.bind(:_refresh_cursor_) { |name| Vedeu::RefreshCursor.render(name) }
|
|
199
199
|
|
|
200
200
|
# Will cause all interfaces in the named group to refresh.
|
|
201
201
|
Vedeu.bind(:_refresh_group_) { |name| Vedeu::Refresh.by_group(name) }
|
|
@@ -398,7 +398,7 @@ module Vedeu
|
|
|
398
398
|
# @param value [Fixnum]
|
|
399
399
|
# @return [Boolean]
|
|
400
400
|
def valid_colour_mode?(value)
|
|
401
|
-
value.is_a?(Fixnum) && [8, 16, 256,
|
|
401
|
+
value.is_a?(Fixnum) && [8, 16, 256, 16_777_216].include?(value)
|
|
402
402
|
end
|
|
403
403
|
|
|
404
404
|
# Checks that the value provided to {#exit_key}, {#focus_next_key},
|
|
@@ -75,7 +75,7 @@ module Vedeu
|
|
|
75
75
|
opts.on('-C', '--colour-mode [COLOURS]', Integer,
|
|
76
76
|
'Run application in either `8`, `16`, `256` or `16777216` ' \
|
|
77
77
|
'colour mode.') do |colours|
|
|
78
|
-
if [8, 16, 256,
|
|
78
|
+
if [8, 16, 256, 16_777_216].include?(colours)
|
|
79
79
|
options[:colour_mode] = colours
|
|
80
80
|
|
|
81
81
|
else
|
|
@@ -93,7 +93,8 @@ module Vedeu
|
|
|
93
93
|
options[:drb] = true
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
-
opts.on('--drb-host',
|
|
96
|
+
opts.on('--drb-host',
|
|
97
|
+
'Set the hostname/IP for the DRb server.') do |hostname|
|
|
97
98
|
#options[:drb] = true
|
|
98
99
|
options[:drb_host] = hostname
|
|
99
100
|
end
|
data/lib/vedeu/cursor/cursor.rb
CHANGED
|
@@ -91,7 +91,7 @@ module Vedeu
|
|
|
91
91
|
# @return [String]
|
|
92
92
|
def to_s(&block)
|
|
93
93
|
if block_given?
|
|
94
|
-
[
|
|
94
|
+
[sequence, yield, sequence].join
|
|
95
95
|
|
|
96
96
|
else
|
|
97
97
|
sequence
|
|
@@ -124,7 +124,7 @@ module Vedeu
|
|
|
124
124
|
#
|
|
125
125
|
# @return [String]
|
|
126
126
|
def sequence
|
|
127
|
-
[
|
|
127
|
+
[position, visibility].join
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
# Returns the escape sequence for setting the visibility of the cursor.
|
|
@@ -6,7 +6,7 @@ module Vedeu
|
|
|
6
6
|
class RefreshCursor
|
|
7
7
|
|
|
8
8
|
# @param (see #initialize)
|
|
9
|
-
def self.render(name)
|
|
9
|
+
def self.render(name = Vedeu.focus)
|
|
10
10
|
new(name).render
|
|
11
11
|
end
|
|
12
12
|
|
|
@@ -20,6 +20,8 @@ module Vedeu
|
|
|
20
20
|
|
|
21
21
|
# @return [Array]
|
|
22
22
|
def render
|
|
23
|
+
Vedeu.log(type: :info, message: "Refreshing cursor: '#{name}'")
|
|
24
|
+
|
|
23
25
|
Vedeu::Refresh.by_name(name) if refresh_view?
|
|
24
26
|
|
|
25
27
|
Vedeu::Terminal.output(new_cursor.to_s)
|
data/lib/vedeu/events/event.rb
CHANGED
|
@@ -102,12 +102,10 @@ module Vedeu
|
|
|
102
102
|
end
|
|
103
103
|
alias_method :unevent, :unbind
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
extend Forwardable
|
|
106
|
+
|
|
107
|
+
def_delegators Vedeu::Trigger, :trigger
|
|
106
108
|
|
|
107
|
-
# @param (see Vedeu::Trigger.trigger)
|
|
108
|
-
# @see Vedeu::Trigger.trigger
|
|
109
|
-
def self.trigger(name, *args)
|
|
110
|
-
Vedeu::Trigger.trigger(name, *args)
|
|
111
109
|
end
|
|
112
110
|
|
|
113
111
|
# Returns a new instance of Vedeu::Event.
|
data/lib/vedeu/input/all.rb
CHANGED
|
@@ -10,7 +10,7 @@ module Vedeu
|
|
|
10
10
|
# Vedeu to run effectively.
|
|
11
11
|
Vedeu::DSL::Keymap.keymap('_system_') do |keymap|
|
|
12
12
|
Vedeu::Configuration.system_keys.each do |label, keypress|
|
|
13
|
-
keymap.key(keypress) { Vedeu.trigger(("_
|
|
13
|
+
keymap.key(keypress) { Vedeu.trigger(("_#{label}_").to_sym) }
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
data/lib/vedeu/input/key.rb
CHANGED
|
@@ -4,6 +4,11 @@ module Vedeu
|
|
|
4
4
|
#
|
|
5
5
|
class Key
|
|
6
6
|
|
|
7
|
+
# @!attribute [r] input
|
|
8
|
+
# @return [String|Symbol] Returns the key defined.
|
|
9
|
+
attr_reader :input
|
|
10
|
+
alias_method :key, :input
|
|
11
|
+
|
|
7
12
|
# Returns a new instance of Vedeu::Key.
|
|
8
13
|
#
|
|
9
14
|
# @param input [String|Symbol]
|
|
@@ -17,14 +22,6 @@ module Vedeu
|
|
|
17
22
|
@output = block
|
|
18
23
|
end
|
|
19
24
|
|
|
20
|
-
# Returns the key defined.
|
|
21
|
-
#
|
|
22
|
-
# @return [String|Symbol]
|
|
23
|
-
def input
|
|
24
|
-
@input
|
|
25
|
-
end
|
|
26
|
-
alias_method :key, :input
|
|
27
|
-
|
|
28
25
|
# Pressing the key will call the procedure.
|
|
29
26
|
#
|
|
30
27
|
# @return [|Symbol]
|
data/lib/vedeu/models/all.rb
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
require 'vedeu/repositories/all'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
require_relative 'cell'
|
|
4
|
+
require_relative 'char'
|
|
5
|
+
require_relative 'stream'
|
|
6
|
+
require_relative 'line'
|
|
7
|
+
require_relative 'interface'
|
|
8
|
+
require_relative 'composition'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
module Vedeu
|
|
15
|
-
end # Vedeu
|
|
10
|
+
require_relative 'focus'
|
|
11
|
+
require_relative 'group'
|
|
12
|
+
require_relative 'menu'
|
data/lib/vedeu/models/menu.rb
CHANGED
|
@@ -95,7 +95,7 @@ module Vedeu
|
|
|
95
95
|
# Returns a new collection of items.
|
|
96
96
|
# Each element of the collection is of the format:
|
|
97
97
|
#
|
|
98
|
-
# [
|
|
98
|
+
# [selected, current, item]
|
|
99
99
|
#
|
|
100
100
|
# `selected` is a boolean indicating whether the item is selected.
|
|
101
101
|
# `current` is a boolean indicating whether the item is current.
|
data/lib/vedeu/output/border.rb
CHANGED
|
@@ -252,20 +252,20 @@ module Vedeu
|
|
|
252
252
|
# @param prefix [String]
|
|
253
253
|
# @return [String]
|
|
254
254
|
def top_or_bottom(prefix)
|
|
255
|
-
predicate
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
predicate = (prefix + '?').to_sym
|
|
256
|
+
prefix_left = (prefix + '_left').to_sym
|
|
257
|
+
prefix_right = (prefix + '_right').to_sym
|
|
258
|
+
prefix_horizontal = (prefix + '_horizontal').to_sym
|
|
259
259
|
|
|
260
260
|
return [] unless send(predicate)
|
|
261
261
|
|
|
262
262
|
out = []
|
|
263
|
-
out << border(send(
|
|
263
|
+
out << border(send(prefix_left), prefix_left) if left?
|
|
264
264
|
|
|
265
265
|
if prefix == 'top' && defined_value?(title)
|
|
266
266
|
title_out = []
|
|
267
267
|
width.times do |ix|
|
|
268
|
-
title_out << border(horizontal,
|
|
268
|
+
title_out << border(horizontal, prefix_horizontal, nil, ix)
|
|
269
269
|
end
|
|
270
270
|
|
|
271
271
|
truncate = title.chomp.slice(0..(width - 5))
|
|
@@ -279,12 +279,12 @@ module Vedeu
|
|
|
279
279
|
|
|
280
280
|
else
|
|
281
281
|
width.times do |ix|
|
|
282
|
-
out << border(horizontal,
|
|
282
|
+
out << border(horizontal, prefix_horizontal, nil, ix)
|
|
283
283
|
end
|
|
284
284
|
|
|
285
285
|
end
|
|
286
286
|
|
|
287
|
-
out << border(send(
|
|
287
|
+
out << border(send(prefix_right), prefix_right) if right?
|
|
288
288
|
out
|
|
289
289
|
end
|
|
290
290
|
|
|
@@ -309,15 +309,19 @@ module Vedeu
|
|
|
309
309
|
|
|
310
310
|
# The default values for a new instance of this class.
|
|
311
311
|
#
|
|
312
|
+
# @note
|
|
313
|
+
# Using the '\uXXXX' variant produces gaps in the border, whilst the
|
|
314
|
+
# '\xXX' renders 'nicely'.
|
|
315
|
+
#
|
|
312
316
|
# @return [Hash]
|
|
313
317
|
def defaults
|
|
314
318
|
{
|
|
315
|
-
bottom_left: "\x6D", # └
|
|
316
|
-
bottom_right: "\x6A", # ┘
|
|
319
|
+
bottom_left: "\x6D", # └ # \u2514
|
|
320
|
+
bottom_right: "\x6A", # ┘ # \u2518
|
|
317
321
|
client: nil,
|
|
318
322
|
colour: {},
|
|
319
323
|
enabled: false,
|
|
320
|
-
horizontal: "\x71", # ─
|
|
324
|
+
horizontal: "\x71", # ─ # \u2500
|
|
321
325
|
name: '',
|
|
322
326
|
show_bottom: true,
|
|
323
327
|
show_left: true,
|
|
@@ -325,9 +329,9 @@ module Vedeu
|
|
|
325
329
|
show_top: true,
|
|
326
330
|
style: [],
|
|
327
331
|
title: '',
|
|
328
|
-
top_left: "\x6C", # ┌
|
|
329
|
-
top_right: "\x6B", # ┐
|
|
330
|
-
vertical: "\x78", # │
|
|
332
|
+
top_left: "\x6C", # ┌ # \u250C
|
|
333
|
+
top_right: "\x6B", # ┐ # \u2510
|
|
334
|
+
vertical: "\x78", # │ # \u2502
|
|
331
335
|
}
|
|
332
336
|
end
|
|
333
337
|
|
data/lib/vedeu/output/clear.rb
CHANGED
|
@@ -31,12 +31,12 @@ module Vedeu
|
|
|
31
31
|
#
|
|
32
32
|
# @return [Array<Array<Vedeu::Char>>]
|
|
33
33
|
def clear
|
|
34
|
-
@clear ||= Array.new(interface.height) do |iy|
|
|
35
|
-
Array.new(interface.width) do |ix|
|
|
34
|
+
@clear ||= Array.new(interface.border.height) do |iy|
|
|
35
|
+
Array.new(interface.border.width) do |ix|
|
|
36
36
|
Vedeu::Char.new({ value: ' ',
|
|
37
37
|
colour: interface.colour,
|
|
38
38
|
style: interface.style,
|
|
39
|
-
position:
|
|
39
|
+
position: position(iy, ix) })
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -64,6 +64,13 @@ module Vedeu
|
|
|
64
64
|
# @return [Interface]
|
|
65
65
|
attr_reader :interface
|
|
66
66
|
|
|
67
|
+
# @param iy [Fixnum]
|
|
68
|
+
# @param ix [Fixnum]
|
|
69
|
+
# @return [Vedeu::IndexPosition]
|
|
70
|
+
def position(iy, ix)
|
|
71
|
+
Vedeu::IndexPosition[iy, ix, interface.border.by, interface.border.bx]
|
|
72
|
+
end
|
|
73
|
+
|
|
67
74
|
end # Clear
|
|
68
75
|
|
|
69
76
|
end # Vedeu
|
data/lib/vedeu/output/esc.rb
CHANGED
|
@@ -121,7 +121,7 @@ module Vedeu
|
|
|
121
121
|
def border(&block)
|
|
122
122
|
return '' unless block_given?
|
|
123
123
|
|
|
124
|
-
[
|
|
124
|
+
[border_on, yield, border_off].join
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
private
|
|
@@ -167,18 +167,12 @@ module Vedeu
|
|
|
167
167
|
|
|
168
168
|
# @return [String]
|
|
169
169
|
def clear
|
|
170
|
-
[
|
|
171
|
-
colour_reset,
|
|
172
|
-
"\e[2J"
|
|
173
|
-
].join
|
|
170
|
+
[colour_reset, "\e[2J"].join
|
|
174
171
|
end
|
|
175
172
|
|
|
176
173
|
# @return [String]
|
|
177
174
|
def clear_line
|
|
178
|
-
[
|
|
179
|
-
colour_reset,
|
|
180
|
-
"\e[2K"
|
|
181
|
-
].join
|
|
175
|
+
[colour_reset, "\e[2K"].join
|
|
182
176
|
end
|
|
183
177
|
|
|
184
178
|
# @return [String]
|
|
@@ -233,11 +227,7 @@ module Vedeu
|
|
|
233
227
|
|
|
234
228
|
# @return [String]
|
|
235
229
|
def screen_exit
|
|
236
|
-
[
|
|
237
|
-
show_cursor,
|
|
238
|
-
colour_reset,
|
|
239
|
-
reset
|
|
240
|
-
].join
|
|
230
|
+
[show_cursor, colour_reset, reset].join
|
|
241
231
|
end
|
|
242
232
|
|
|
243
233
|
# @return [String]
|
|
@@ -37,7 +37,11 @@ module Vedeu
|
|
|
37
37
|
def td_style
|
|
38
38
|
return '' unless border || defined_value?(value)
|
|
39
39
|
|
|
40
|
-
" style='
|
|
40
|
+
" style='" \
|
|
41
|
+
"background:#{bg};" \
|
|
42
|
+
"color:#{fg};" \
|
|
43
|
+
"border:1px #{bg} solid;" \
|
|
44
|
+
"#{border_style}'"
|
|
41
45
|
end
|
|
42
46
|
|
|
43
47
|
# @return [String]
|
|
@@ -55,12 +59,12 @@ module Vedeu
|
|
|
55
59
|
when :left_vertical then border_css('left')
|
|
56
60
|
when :right_vertical then border_css('right')
|
|
57
61
|
when :bottom_horizontal then border_css('bottom')
|
|
58
|
-
when :top_left
|
|
59
|
-
when :top_right
|
|
60
|
-
when :bottom_left
|
|
61
|
-
when :bottom_right
|
|
62
|
-
when :horizontal
|
|
63
|
-
when :vertical
|
|
62
|
+
when :top_left then [border_css('top'), border_css('left')].join
|
|
63
|
+
when :top_right then [border_css('top'), border_css('right')].join
|
|
64
|
+
when :bottom_left then [border_css('bottom'), border_css('left')].join
|
|
65
|
+
when :bottom_right then [border_css('bottom'), border_css('right')].join
|
|
66
|
+
when :horizontal then ''
|
|
67
|
+
when :vertical then ''
|
|
64
68
|
else
|
|
65
69
|
# ... should not get here
|
|
66
70
|
''
|
|
@@ -33,11 +33,21 @@ module Vedeu
|
|
|
33
33
|
interface.yn
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
# @return [Fixnum]
|
|
37
|
+
def height
|
|
38
|
+
(by..byn).size
|
|
39
|
+
end
|
|
40
|
+
|
|
36
41
|
# @return [Array]
|
|
37
42
|
def render
|
|
38
43
|
[]
|
|
39
44
|
end
|
|
40
45
|
|
|
46
|
+
# @return [Fixnum]
|
|
47
|
+
def width
|
|
48
|
+
(bx..bxn).size
|
|
49
|
+
end
|
|
50
|
+
|
|
41
51
|
private
|
|
42
52
|
|
|
43
53
|
# @!attribute [r] interface
|
|
@@ -7,9 +7,7 @@ module Vedeu
|
|
|
7
7
|
|
|
8
8
|
# @return [Vedeu::Background|NilClass]
|
|
9
9
|
def background
|
|
10
|
-
if colour
|
|
11
|
-
colour.background
|
|
12
|
-
end
|
|
10
|
+
colour.background if colour
|
|
13
11
|
end
|
|
14
12
|
|
|
15
13
|
# @return [Vedeu::Colour]
|
|
@@ -24,16 +22,12 @@ module Vedeu
|
|
|
24
22
|
|
|
25
23
|
# @return [Vedeu::Foreground|NilClass]
|
|
26
24
|
def foreground
|
|
27
|
-
if colour
|
|
28
|
-
colour.foreground
|
|
29
|
-
end
|
|
25
|
+
colour.foreground if colour
|
|
30
26
|
end
|
|
31
27
|
|
|
32
28
|
# @return [Vedeu::Background|NilClass]
|
|
33
29
|
def parent_background
|
|
34
|
-
if parent_colour
|
|
35
|
-
parent_colour.background
|
|
36
|
-
end
|
|
30
|
+
parent_colour.background if parent_colour
|
|
37
31
|
end
|
|
38
32
|
|
|
39
33
|
# @return [String|NilClass]
|
|
@@ -43,9 +37,7 @@ module Vedeu
|
|
|
43
37
|
|
|
44
38
|
# @return [Vedeu::Foreground|NilClass]
|
|
45
39
|
def parent_foreground
|
|
46
|
-
if parent_colour
|
|
47
|
-
parent_colour.foreground
|
|
48
|
-
end
|
|
40
|
+
parent_colour.foreground if parent_colour
|
|
49
41
|
end
|
|
50
42
|
|
|
51
43
|
# @return [String|NilClass]
|
|
@@ -91,11 +83,7 @@ module Vedeu
|
|
|
91
83
|
#
|
|
92
84
|
# @return [String]
|
|
93
85
|
def render_colour
|
|
94
|
-
[
|
|
95
|
-
colour,
|
|
96
|
-
yield,
|
|
97
|
-
parent_colour
|
|
98
|
-
].join
|
|
86
|
+
[colour, yield, parent_colour].join
|
|
99
87
|
end
|
|
100
88
|
|
|
101
89
|
# @return [String]
|
|
@@ -115,11 +103,7 @@ module Vedeu
|
|
|
115
103
|
#
|
|
116
104
|
# @return [String]
|
|
117
105
|
def render_style
|
|
118
|
-
[
|
|
119
|
-
style,
|
|
120
|
-
yield,
|
|
121
|
-
parent_style
|
|
122
|
-
].join
|
|
106
|
+
[style, yield, parent_style].join
|
|
123
107
|
end
|
|
124
108
|
|
|
125
109
|
end # Presentation
|