vedeu 0.6.8 → 0.6.9
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/.yardopts +9 -0
- data/README.md +1 -1
- data/docs/api.md +60 -67
- data/docs/configuration.md +8 -5
- data/docs/events.md +31 -15
- data/docs/events/application.md +12 -0
- data/docs/events/document.md +57 -0
- data/docs/events/drb.md +43 -0
- data/docs/events/focus.md +24 -0
- data/docs/events/menu.md +57 -0
- data/docs/events/movement.md +57 -0
- data/docs/events/refresh.md +25 -0
- data/docs/events/system.md +90 -0
- data/docs/events/visibility.md +68 -0
- data/lib/vedeu.rb +2 -2
- data/lib/vedeu/all.rb +3 -2
- data/lib/vedeu/api.rb +18 -18
- data/lib/vedeu/application/controller.rb +1 -1
- data/lib/vedeu/application/helper.rb +1 -1
- data/lib/vedeu/application/view.rb +1 -1
- data/lib/vedeu/bindings/application.rb +1 -12
- data/lib/vedeu/bindings/bindings.rb +3 -1
- data/lib/vedeu/bindings/document.rb +9 -62
- data/lib/vedeu/bindings/drb.rb +12 -56
- data/lib/vedeu/bindings/focus.rb +3 -28
- data/lib/vedeu/bindings/menus.rb +10 -66
- data/lib/vedeu/bindings/movement.rb +4 -69
- data/lib/vedeu/bindings/refresh.rb +3 -33
- data/lib/vedeu/bindings/system.rb +14 -100
- data/lib/vedeu/bindings/visibility.rb +20 -71
- data/lib/vedeu/borders/all.rb +4 -3
- data/lib/vedeu/borders/border.rb +39 -33
- data/lib/vedeu/borders/dsl.rb +40 -33
- data/lib/vedeu/borders/null.rb +2 -2
- data/lib/vedeu/borders/render.rb +29 -24
- data/lib/vedeu/borders/repository.rb +2 -2
- data/lib/vedeu/buffers/all.rb +8 -7
- data/lib/vedeu/buffers/buffer.rb +47 -39
- data/lib/vedeu/buffers/null.rb +2 -2
- data/lib/vedeu/buffers/refresh.rb +4 -3
- data/lib/vedeu/buffers/virtual_buffer.rb +122 -118
- data/lib/vedeu/buffers/virtual_buffers.rb +62 -56
- data/lib/vedeu/colours/background.rb +2 -1
- data/lib/vedeu/colours/colour.rb +21 -19
- data/lib/vedeu/colours/foreground.rb +2 -1
- data/lib/vedeu/colours/repository.rb +6 -5
- data/lib/vedeu/colours/translator.rb +39 -35
- data/lib/vedeu/configuration/api.rb +59 -51
- data/lib/vedeu/configuration/cli.rb +9 -7
- data/lib/vedeu/configuration/configuration.rb +41 -32
- data/lib/vedeu/cursors/cursor.rb +1 -1
- data/lib/vedeu/cursors/refresh.rb +20 -16
- data/lib/vedeu/distributed/server.rb +8 -6
- data/lib/vedeu/distributed/subprocess.rb +90 -86
- data/lib/vedeu/distributed/uri.rb +4 -3
- data/lib/vedeu/dsl/composition.rb +2 -2
- data/lib/vedeu/dsl/group.rb +4 -4
- data/lib/vedeu/dsl/interface.rb +5 -5
- data/lib/vedeu/dsl/presentation.rb +2 -2
- data/lib/vedeu/dsl/text.rb +1 -1
- data/lib/vedeu/editor/cropper.rb +4 -4
- data/lib/vedeu/editor/cursor.rb +6 -4
- data/lib/vedeu/editor/document.rb +20 -18
- data/lib/vedeu/editor/editor.rb +2 -2
- data/lib/vedeu/editor/line.rb +10 -5
- data/lib/vedeu/editor/lines.rb +2 -2
- data/lib/vedeu/internal_api.rb +4 -4
- data/lib/vedeu/models/focus.rb +197 -191
- data/lib/vedeu/models/group.rb +171 -159
- data/lib/vedeu/models/groups.rb +14 -10
- data/lib/vedeu/models/interface.rb +116 -110
- data/lib/vedeu/models/interfaces.rb +24 -20
- data/lib/vedeu/models/toggleable.rb +4 -4
- 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 +1 -1
- data/lib/vedeu/null/interface.rb +1 -1
- data/lib/vedeu/null/view.rb +1 -1
- data/lib/vedeu/output/clear/named_interface.rb +1 -1
- data/lib/vedeu/output/compressor.rb +78 -73
- data/lib/vedeu/output/direct.rb +61 -57
- data/lib/vedeu/output/output.rb +34 -29
- data/lib/vedeu/output/{presentation.rb → presentation/presentation.rb} +2 -1
- data/lib/vedeu/output/presentation/style.rb +64 -18
- data/lib/vedeu/output/presentation/styles.rb +39 -0
- data/lib/vedeu/output/renderers/html.rb +2 -2
- data/lib/vedeu/output/renderers/json.rb +2 -1
- data/lib/vedeu/output/renderers/terminal.rb +3 -3
- data/lib/vedeu/output/renderers/text.rb +3 -3
- data/lib/vedeu/output/text.rb +186 -180
- data/lib/vedeu/output/wordwrap.rb +142 -138
- data/lib/vedeu/refresh/refresh.rb +2 -2
- data/lib/vedeu/templating/helpers.rb +11 -6
- 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/borders/render_test.rb +1 -1
- data/test/lib/vedeu/buffers/buffer_test.rb +16 -14
- data/test/lib/vedeu/buffers/virtual_buffer_test.rb +105 -101
- data/test/lib/vedeu/buffers/virtual_buffers_test.rb +43 -39
- data/test/lib/vedeu/colours/colour_test.rb +4 -4
- data/test/lib/vedeu/cursors/cursor_test.rb +2 -2
- data/test/lib/vedeu/cursors/repository_test.rb +3 -3
- data/test/lib/vedeu/distributed/subprocess_test.rb +33 -29
- data/test/lib/vedeu/dsl/group_test.rb +3 -3
- data/test/lib/vedeu/dsl/interface_test.rb +6 -5
- data/test/lib/vedeu/dsl/line_test.rb +4 -2
- data/test/lib/vedeu/dsl/presentation_test.rb +2 -2
- data/test/lib/vedeu/dsl/text_test.rb +8 -8
- data/test/lib/vedeu/editor/document_test.rb +10 -6
- data/test/lib/vedeu/input/keymap_test.rb +1 -10
- data/test/lib/vedeu/models/focus_test.rb +177 -170
- data/test/lib/vedeu/models/group_test.rb +99 -95
- data/test/lib/vedeu/models/groups_test.rb +13 -9
- data/test/lib/vedeu/models/interface_test.rb +93 -87
- data/test/lib/vedeu/models/interfaces_test.rb +24 -20
- data/test/lib/vedeu/models/views/char_test.rb +2 -2
- data/test/lib/vedeu/models/views/line_test.rb +11 -7
- data/test/lib/vedeu/models/views/stream_test.rb +1 -1
- data/test/lib/vedeu/models/views/view_test.rb +1 -1
- data/test/lib/vedeu/output/clear/named_group_test.rb +1 -1
- data/test/lib/vedeu/output/clear/named_interface_test.rb +3 -1
- data/test/lib/vedeu/output/compressor_test.rb +126 -122
- data/test/lib/vedeu/output/direct_test.rb +49 -43
- data/test/lib/vedeu/output/output_test.rb +35 -31
- data/test/lib/vedeu/output/{presentation_test.rb → presentation/presentation_test.rb} +11 -7
- data/test/lib/vedeu/output/presentation/style_test.rb +88 -48
- data/test/lib/vedeu/output/presentation/styles_test.rb +84 -0
- data/test/lib/vedeu/output/text_test.rb +109 -105
- data/test/lib/vedeu/output/viewport_test.rb +3 -1
- data/test/lib/vedeu/output/wordwrap_test.rb +209 -205
- data/test/lib/vedeu/refresh/refresh_test.rb +3 -1
- data/test/lib/vedeu/templating/helpers_test.rb +6 -6
- data/test/lib/vedeu/templating/view_template_test.rb +1 -1
- metadata +17 -8
- data/lib/vedeu/output/style.rb +0 -76
- data/test/lib/vedeu/output/style_test.rb +0 -120
data/lib/vedeu/buffers/null.rb
CHANGED
@@ -11,8 +11,8 @@ module Vedeu
|
|
11
11
|
|
12
12
|
include Vedeu::Common
|
13
13
|
|
14
|
-
# @param name [String] The name of the interface to be refreshed
|
15
|
-
# named buffer.
|
14
|
+
# @param name [String] The name of the interface to be refreshed
|
15
|
+
# using the named buffer.
|
16
16
|
# @return [Array|Vedeu::Error::ModelNotFound]
|
17
17
|
def self.by_name(name)
|
18
18
|
new(name).by_name
|
@@ -41,7 +41,8 @@ module Vedeu
|
|
41
41
|
|
42
42
|
private
|
43
43
|
|
44
|
-
# @raise [Vedeu::Error::MissingRequired] When the name is empty
|
44
|
+
# @raise [Vedeu::Error::MissingRequired] When the name is empty
|
45
|
+
# or nil.
|
45
46
|
# @return [String]
|
46
47
|
def buffer_name
|
47
48
|
return name if present?(name)
|
@@ -1,132 +1,136 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
|
4
|
-
# {Vedeu::Models::Cell} objects.
|
5
|
-
#
|
6
|
-
class VirtualBuffer
|
7
|
-
|
8
|
-
# @!attribute [rw] renderer
|
9
|
-
# @return [void]
|
10
|
-
attr_accessor :renderer
|
11
|
-
|
12
|
-
# @!attribute [r] height
|
13
|
-
# @return [Fixnum]
|
14
|
-
attr_reader :height
|
15
|
-
|
16
|
-
# @!attribute [r] width
|
17
|
-
# @return [Fixnum]
|
18
|
-
attr_reader :width
|
19
|
-
|
20
|
-
# @param data [Array<Array<Vedeu::Views::Char>>]
|
21
|
-
# @return [Array<Array<Vedeu::Views::Char>>]
|
22
|
-
# @see Vedeu::VirtualBuffer#output
|
23
|
-
def self.output(data)
|
24
|
-
new(Vedeu.height, Vedeu.width, Vedeu::Renderers::HTML.new).output(data)
|
25
|
-
end
|
26
|
-
|
27
|
-
# Returns a new instance of Vedeu::VirtualBuffer.
|
28
|
-
#
|
29
|
-
# @param height [Fixnum]
|
30
|
-
# @param width [Fixnum]
|
31
|
-
# @param renderer [Object|Vedeu::Renderers::HTML] An object
|
32
|
-
# responding to .render.
|
33
|
-
# @return [Vedeu::VirtualBuffer]
|
34
|
-
def initialize(height, width, renderer = Vedeu::Renderers::HTML.new)
|
35
|
-
@height = height
|
36
|
-
@width = width
|
37
|
-
@renderer = renderer
|
38
|
-
end
|
39
|
-
|
40
|
-
# Return a grid of {Vedeu::Views::Char} objects defined by the
|
41
|
-
# height and width of this virtual terminal.
|
42
|
-
#
|
43
|
-
# @return [Array<Array<Vedeu::Views::Char>>]
|
44
|
-
def cells
|
45
|
-
@cells ||= new_virtual_buffer
|
46
|
-
end
|
3
|
+
module Buffers
|
47
4
|
|
48
|
-
#
|
5
|
+
# Represents a {Vedeu::Terminal} view as a grid of
|
6
|
+
# {Vedeu::Models::Cell} objects.
|
49
7
|
#
|
50
|
-
|
51
|
-
# Given two actual coordinates (y, x) e.g. (1, 1)
|
52
|
-
# Convert to coordinate indices (cy, cx) e.g. (0, 0)
|
53
|
-
# Fetch the row at cy and return the cell from cx
|
54
|
-
#
|
55
|
-
# @param y [Fixnum] The row/line coordinate.
|
56
|
-
# @param x [Fixnum] The column/character coordinate.
|
57
|
-
# @return [Vedeu::Views::Char]
|
58
|
-
def read(y, x)
|
59
|
-
cy, cx = Vedeu::Geometry::Position[y, x].as_indices
|
8
|
+
class VirtualBuffer
|
60
9
|
|
61
|
-
|
62
|
-
|
10
|
+
# @!attribute [rw] renderer
|
11
|
+
# @return [void]
|
12
|
+
attr_accessor :renderer
|
63
13
|
|
64
|
-
|
65
|
-
|
14
|
+
# @!attribute [r] height
|
15
|
+
# @return [Fixnum]
|
16
|
+
attr_reader :height
|
66
17
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
18
|
+
# @!attribute [r] width
|
19
|
+
# @return [Fixnum]
|
20
|
+
attr_reader :width
|
21
|
+
|
22
|
+
# @param data [Array<Array<Vedeu::Views::Char>>]
|
23
|
+
# @return [Array<Array<Vedeu::Views::Char>>]
|
24
|
+
# @see Vedeu::Buffers::VirtualBuffer#output
|
25
|
+
def self.output(data)
|
26
|
+
new(Vedeu.height, Vedeu.width, Vedeu::Renderers::HTML.new).output(data)
|
74
27
|
end
|
75
28
|
|
76
|
-
|
77
|
-
|
29
|
+
# Returns a new instance of Vedeu::Buffers::VirtualBuffer.
|
30
|
+
#
|
31
|
+
# @param height [Fixnum]
|
32
|
+
# @param width [Fixnum]
|
33
|
+
# @param renderer [Object|Vedeu::Renderers::HTML] An object
|
34
|
+
# responding to .render.
|
35
|
+
# @return [Vedeu::Buffers::VirtualBuffer]
|
36
|
+
def initialize(height, width, renderer = Vedeu::Renderers::HTML.new)
|
37
|
+
@height = height
|
38
|
+
@width = width
|
39
|
+
@renderer = renderer
|
40
|
+
end
|
78
41
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
42
|
+
# Return a grid of {Vedeu::Views::Char} objects defined by the
|
43
|
+
# height and width of this virtual terminal.
|
44
|
+
#
|
45
|
+
# @return [Array<Array<Vedeu::Views::Char>>]
|
46
|
+
def cells
|
47
|
+
@cells ||= new_virtual_buffer
|
48
|
+
end
|
85
49
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
50
|
+
# Read a single cell from the virtual terminal.
|
51
|
+
#
|
52
|
+
# @note
|
53
|
+
# Given two actual coordinates (y, x) e.g. (1, 1)
|
54
|
+
# Convert to coordinate indices (cy, cx) e.g. (0, 0)
|
55
|
+
# Fetch the row at cy and return the cell from cx
|
56
|
+
#
|
57
|
+
# @param y [Fixnum] The row/line coordinate.
|
58
|
+
# @param x [Fixnum] The column/character coordinate.
|
59
|
+
# @return [Vedeu::Views::Char]
|
60
|
+
def read(y, x)
|
61
|
+
cy, cx = Vedeu::Geometry::Position[y, x].as_indices
|
62
|
+
|
63
|
+
row = fetch(cells, cy)
|
64
|
+
cell = fetch(row, cx)
|
65
|
+
|
66
|
+
cell
|
67
|
+
end
|
94
68
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
69
|
+
# Write a collection of cells to the virtual terminal.
|
70
|
+
#
|
71
|
+
# @param data [Array<Array<Vedeu::Views::Char>>]
|
72
|
+
# @return [Array<Array<Vedeu::Views::Char>>]
|
73
|
+
def output(data)
|
74
|
+
Array(data).flatten.each do |char|
|
75
|
+
write(char.y, char.x, char) if char.is_a?(Vedeu::Views::Char)
|
76
|
+
end
|
77
|
+
|
78
|
+
cells
|
79
|
+
end
|
80
|
+
|
81
|
+
# Send the cells to the renderer and return the rendered result.
|
82
|
+
#
|
83
|
+
# @return [String|void] Most likely to be a String.
|
84
|
+
def render
|
85
|
+
renderer.render(cells)
|
86
|
+
end
|
87
|
+
|
88
|
+
# Removes all content from the virtual terminal; effectively
|
89
|
+
# clearing it.
|
90
|
+
#
|
91
|
+
# @return [Array<Array<Vedeu::Views::Char>>]
|
92
|
+
def reset
|
93
|
+
@cells = new_virtual_buffer
|
94
|
+
end
|
95
|
+
alias_method :clear, :reset
|
96
|
+
|
97
|
+
# Write a single cell to the virtual terminal.
|
98
|
+
#
|
99
|
+
# @note
|
100
|
+
# If the position (y, x) is nil; we're out of bounds.
|
101
|
+
# Otherwise, write the data to (cy, cx).
|
102
|
+
#
|
103
|
+
# @param y [Fixnum] The row/line coordinate.
|
104
|
+
# @param x [Fixnum] The column/character coordinate.
|
105
|
+
# @param data [Vedeu::Views::Char]
|
106
|
+
# @return [Vedeu::Views::Char]
|
107
|
+
def write(y, x, data)
|
108
|
+
return false unless read(y, x).is_a?(Vedeu::Models::Cell)
|
109
|
+
|
110
|
+
cy, cx = Vedeu::Geometry::Position[y, x].as_indices
|
111
|
+
cells[cy][cx] = data
|
112
|
+
|
113
|
+
true
|
114
|
+
end
|
115
|
+
|
116
|
+
private
|
117
|
+
|
118
|
+
# @param from [Array] An Array of rows, or an Array of cells.
|
119
|
+
# @param which [Fixnum] A Fixnum representing the index; the row
|
120
|
+
# number or the cell number for a row.
|
121
|
+
# @return [Array<Vedeu::Views::Char>|Array]
|
122
|
+
def fetch(from, which)
|
123
|
+
from[which] || []
|
124
|
+
end
|
125
|
+
|
126
|
+
# @return [Array<Array<Vedeu::Models::Cell>>]
|
127
|
+
# @see Vedeu::Buffers::VirtualBuffer#cells
|
128
|
+
def new_virtual_buffer
|
129
|
+
Array.new(height) { Array.new(width) { Vedeu::Models::Cell.new } }
|
130
|
+
end
|
131
|
+
|
132
|
+
end # VirtualBuffer
|
133
|
+
|
134
|
+
end # Buffers
|
131
135
|
|
132
136
|
end # Vedeu
|
@@ -1,71 +1,77 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
|
4
|
-
#
|
5
|
-
# Each {Vedeu::VirtualBuffer} object is a copy of the current terminal
|
6
|
-
# including content but not as String objects but {Vedeu::Views::Char}
|
7
|
-
# objects. Using {Vedeu::Views::Char} objects means that we can store the data
|
8
|
-
# used to make up the displayed character, complete with its colour, position
|
9
|
-
# and style.
|
10
|
-
#
|
11
|
-
# Once a {Vedeu::Views::Char} has been converted to a String, it is tricky to
|
12
|
-
# separate the escape sequences and string data. By deferring this conversion
|
13
|
-
# we can display the {Vedeu::Views::Char} in multiple ways (e.g. HTML) or in
|
14
|
-
# multiple formats (e.g. JSON), and render/use that in an appropriate way.
|
15
|
-
#
|
16
|
-
module VirtualBuffers
|
3
|
+
module Buffers
|
17
4
|
|
18
|
-
|
19
|
-
|
20
|
-
#
|
5
|
+
# Store and retrieve {Vedeu::Buffers::VirtualBuffer} objects.
|
6
|
+
#
|
7
|
+
# Each {Vedeu::Buffers::VirtualBuffer} object is a copy of the
|
8
|
+
# current terminal including content but not as String objects but
|
9
|
+
# {Vedeu::Views::Char} objects. Using {Vedeu::Views::Char} objects
|
10
|
+
# means that we can store the data used to make up the displayed
|
11
|
+
# character, complete with its colour, position and style.
|
12
|
+
#
|
13
|
+
# Once a {Vedeu::Views::Char} has been converted to a String, it
|
14
|
+
# is tricky to separate the escape sequences and string data. By
|
15
|
+
# deferring this conversion we can display the
|
16
|
+
# {Vedeu::Views::Char} in multiple ways (e.g. HTML) or in multiple
|
17
|
+
# formats (e.g. JSON), and render/use that in an appropriate way.
|
21
18
|
#
|
22
|
-
|
23
|
-
def retrieve
|
24
|
-
Vedeu.log(type: :drb, message: 'Retrieving output')
|
19
|
+
module VirtualBuffers
|
25
20
|
|
26
|
-
|
27
|
-
end
|
21
|
+
extend self
|
28
22
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
23
|
+
# Fetch the oldest stored virtual buffer first.
|
24
|
+
#
|
25
|
+
# @return [Array<Array<Vedeu::Views::Char>>|NilClass]
|
26
|
+
def retrieve
|
27
|
+
Vedeu.log(type: :drb, message: 'Retrieving output')
|
34
28
|
|
35
|
-
|
36
|
-
|
29
|
+
storage.pop
|
30
|
+
end
|
37
31
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
32
|
+
# Store a new virtual buffer.
|
33
|
+
#
|
34
|
+
# @return [Array<Array<Vedeu::Views::Char>>]
|
35
|
+
def store(data)
|
36
|
+
Vedeu.log(type: :drb, message: 'Storing output')
|
44
37
|
|
45
|
-
|
46
|
-
|
47
|
-
# @return [Array]
|
48
|
-
def clear
|
49
|
-
@storage = in_memory
|
50
|
-
end
|
51
|
-
alias_method :reset, :clear
|
38
|
+
storage.unshift(data)
|
39
|
+
end
|
52
40
|
|
53
|
-
|
41
|
+
# Return the number of virtual buffers currently stored.
|
42
|
+
#
|
43
|
+
# @return [Fixnum]
|
44
|
+
def size
|
45
|
+
storage.size
|
46
|
+
end
|
54
47
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
48
|
+
# Destroy all virtual buffers currently stored.
|
49
|
+
#
|
50
|
+
# @return [Array]
|
51
|
+
def clear
|
52
|
+
@storage = in_memory
|
53
|
+
end
|
54
|
+
alias_method :reset, :clear
|
61
55
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
[]
|
67
|
-
|
56
|
+
private
|
57
|
+
|
58
|
+
# Access to the storage for this repository.
|
59
|
+
#
|
60
|
+
# @return [Array]
|
61
|
+
def storage
|
62
|
+
@storage ||= in_memory
|
63
|
+
end
|
64
|
+
|
65
|
+
# Returns an empty collection ready for the storing of virtual
|
66
|
+
# buffers.
|
67
|
+
#
|
68
|
+
# @return [Array]
|
69
|
+
def in_memory
|
70
|
+
[]
|
71
|
+
end
|
72
|
+
|
73
|
+
end # VirtualBuffers
|
68
74
|
|
69
|
-
end #
|
75
|
+
end # Buffers
|
70
76
|
|
71
77
|
end # Vedeu
|
@@ -3,7 +3,8 @@ module Vedeu
|
|
3
3
|
module Colours
|
4
4
|
|
5
5
|
# The class represents one half (the other, can be found at
|
6
|
-
# {Vedeu::Colours::Foreground}) of a terminal colour escape
|
6
|
+
# {Vedeu::Colours::Foreground}) of a terminal colour escape
|
7
|
+
# sequence.
|
7
8
|
#
|
8
9
|
class Background < Vedeu::Colours::Translator
|
9
10
|
|
data/lib/vedeu/colours/colour.rb
CHANGED
@@ -2,17 +2,18 @@ module Vedeu
|
|
2
2
|
|
3
3
|
module Colours
|
4
4
|
|
5
|
-
# Provides a container for terminal escape sequences controlling
|
6
|
-
# foreground and background colours of a character or
|
7
|
-
# characters.
|
5
|
+
# Provides a container for terminal escape sequences controlling
|
6
|
+
# the foreground and background colours of a character or
|
7
|
+
# collection of characters.
|
8
8
|
#
|
9
|
-
# Vedeu uses HTML/CSS style notation (i.e. '#aadd00'), they can be
|
10
|
-
# the stream level, the line level or for the whole
|
11
|
-
# generally support either 8, 16 or 256
|
12
|
-
# 24-bit colour (see notes
|
9
|
+
# Vedeu uses HTML/CSS style notation (i.e. '#aadd00'), they can be
|
10
|
+
# used at the stream level, the line level or for the whole
|
11
|
+
# interface. Terminals generally support either 8, 16 or 256
|
12
|
+
# colours, with few supporting full 24-bit colour (see notes
|
13
|
+
# below).
|
13
14
|
#
|
14
|
-
# Vedeu attempts to detect the colour depth using the `$TERM`
|
15
|
-
# variable.
|
15
|
+
# Vedeu attempts to detect the colour depth using the `$TERM`
|
16
|
+
# environment variable.
|
16
17
|
#
|
17
18
|
# To set your `$TERM` variable to allow 256 colour support:
|
18
19
|
#
|
@@ -21,15 +22,16 @@ module Vedeu
|
|
21
22
|
# ```
|
22
23
|
#
|
23
24
|
# Notes:
|
24
|
-
# Terminals which support the 24-bit colour mode include (but are
|
25
|
-
# limited to): iTerm2 (OSX), Gnome Terminal (Linux).
|
25
|
+
# Terminals which support the 24-bit colour mode include (but are
|
26
|
+
# not limited to): iTerm2 (OSX), Gnome Terminal (Linux).
|
26
27
|
#
|
27
|
-
# Setting your `$TERM` environment variable as above gets you up
|
28
|
-
# colours, but when you then add the
|
29
|
-
# to your client
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
28
|
+
# Setting your `$TERM` environment variable as above gets you up
|
29
|
+
# to 256 colours, but when you then add the
|
30
|
+
# `colour_mode 16_777_216` configuration to your client
|
31
|
+
# application, it's really a hit and miss affair. iTerm2 renders
|
32
|
+
# all the colours correctly as does Gnome Terminal. Terminator
|
33
|
+
# (Linux) goes crazy though and defaults to 16 colours despite the
|
34
|
+
# `$TERM` setting. This area needs more work in Vedeu.
|
33
35
|
#
|
34
36
|
# @todo Fix colours in all terminals. (GL: 2015-04-13)
|
35
37
|
#
|
@@ -101,8 +103,8 @@ module Vedeu
|
|
101
103
|
@foreground = Vedeu::Colours::Foreground.coerce(value)
|
102
104
|
end
|
103
105
|
|
104
|
-
# Returns both or either of the converted attributes into a
|
105
|
-
# sequence.
|
106
|
+
# Returns both or either of the converted attributes into a
|
107
|
+
# single escape sequence.
|
106
108
|
#
|
107
109
|
# @return [String]
|
108
110
|
def to_s
|