vedeu 0.0.34 → 0.0.35
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.rb +14 -3
- data/lib/vedeu/input/input.rb +9 -1
- data/lib/vedeu/models/interface.rb +2 -3
- data/lib/vedeu/models/line.rb +1 -1
- data/lib/vedeu/models/presentation.rb +0 -1
- data/lib/vedeu/models/stream.rb +0 -1
- data/lib/vedeu/output/interface_renderer.rb +1 -1
- data/lib/vedeu/output/text_adaptor.rb +0 -2
- data/lib/vedeu/repository/event_repository.rb +16 -1
- data/lib/vedeu/support/esc.rb +1 -5
- data/lib/vedeu/support/exit.rb +3 -1
- data/lib/vedeu/support/terminal.rb +52 -12
- data/test/example_app/lib/app.rb +6 -8
- data/test/lib/vedeu/models/composition_test.rb +45 -45
- data/test/lib/vedeu/models/interface_test.rb +15 -15
- data/test/lib/vedeu/output/interface_renderer_test.rb +4 -4
- data/test/lib/vedeu/repository/interface_repository_test.rb +3 -3
- data/test/lib/vedeu/support/esc_test.rb +0 -6
- data/test/lib/vedeu/support/event_repository_test.rb +2 -2
- data/test/lib/vedeu/support/exit_test.rb +2 -2
- data/vedeu.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e5bec0b5de4844a5345d59ec1da5c8ad679f8d5
|
4
|
+
data.tar.gz: 1d4e0cfa8a8d21a8ad784467a9e0597218160f6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4722efaa8c4a0cdd1ce6399d55d9f2103d3b9df478e8fa317c342d519f3537ec1d14d5f5f601b152b878a8429c4ca108ec54a2f9ef489d970e096c6638f3a9ec
|
7
|
+
data.tar.gz: 7ae465c0dd6f73cfbfcc6b6b2ef956894d19490c71631237111086c817ee3f2619d9d7684c5fca6821dd929d9f789d5311c5f47cf7b4e4f0f477326b4c102f57
|
data/lib/vedeu/application.rb
CHANGED
@@ -4,6 +4,8 @@ require_relative 'process/process'
|
|
4
4
|
require_relative 'support/terminal'
|
5
5
|
|
6
6
|
module Vedeu
|
7
|
+
ModeSwitch = Class.new(StandardError)
|
8
|
+
|
7
9
|
class Application
|
8
10
|
# :nocov:
|
9
11
|
def self.start(options = {})
|
@@ -11,11 +13,13 @@ module Vedeu
|
|
11
13
|
end
|
12
14
|
|
13
15
|
def initialize(options = {})
|
14
|
-
@options = options
|
16
|
+
@options = options
|
15
17
|
end
|
16
18
|
|
17
19
|
def start
|
18
|
-
Terminal.open do
|
20
|
+
Terminal.open(mode) do
|
21
|
+
Terminal.set_cursor_mode
|
22
|
+
|
19
23
|
Output.render
|
20
24
|
|
21
25
|
runner { main_sequence }
|
@@ -51,19 +55,26 @@ module Vedeu
|
|
51
55
|
def interactive
|
52
56
|
loop { yield }
|
53
57
|
rescue StopIteration
|
58
|
+
rescue ModeSwitch
|
59
|
+
Terminal.mode_switch
|
54
60
|
end
|
55
61
|
|
56
62
|
def run_once
|
57
63
|
yield
|
58
64
|
end
|
59
65
|
|
66
|
+
def mode
|
67
|
+
options.fetch(:mode)
|
68
|
+
end
|
69
|
+
|
60
70
|
def options
|
61
71
|
defaults.merge!(@options)
|
62
72
|
end
|
63
73
|
|
64
74
|
def defaults
|
65
75
|
{
|
66
|
-
interactive: true
|
76
|
+
interactive: true,
|
77
|
+
mode: :raw
|
67
78
|
}
|
68
79
|
end
|
69
80
|
# :nocov:
|
data/lib/vedeu/input/input.rb
CHANGED
@@ -6,11 +6,19 @@ module Vedeu
|
|
6
6
|
extend self
|
7
7
|
|
8
8
|
def capture
|
9
|
-
|
9
|
+
key = input
|
10
|
+
|
11
|
+
Trigger.event(:_mode_switch_) if is_escape?(key)
|
12
|
+
|
13
|
+
Queue.enqueue(key)
|
10
14
|
end
|
11
15
|
|
12
16
|
private
|
13
17
|
|
18
|
+
def is_escape?(key)
|
19
|
+
key.ord == 27
|
20
|
+
end
|
21
|
+
|
14
22
|
def input
|
15
23
|
Terminal.input
|
16
24
|
end
|
@@ -1,21 +1,20 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'virtus'
|
3
3
|
|
4
|
-
require_relative 'presentation'
|
5
4
|
require_relative 'attributes/line_collection'
|
5
|
+
require_relative 'presentation'
|
6
6
|
require_relative 'style'
|
7
7
|
require_relative '../output/interface_renderer'
|
8
8
|
require_relative '../support/coordinate'
|
9
|
-
require_relative '../support/esc'
|
10
9
|
require_relative '../support/queue'
|
11
10
|
require_relative '../support/terminal'
|
12
11
|
|
13
12
|
module Vedeu
|
14
13
|
class Interface
|
14
|
+
include Vedeu::Queue
|
15
15
|
include Virtus.model
|
16
16
|
include Presentation
|
17
17
|
include Style
|
18
|
-
include Vedeu::Queue
|
19
18
|
|
20
19
|
attribute :name, String
|
21
20
|
attribute :lines, LineCollection
|
data/lib/vedeu/models/line.rb
CHANGED
data/lib/vedeu/models/stream.rb
CHANGED
@@ -1,4 +1,18 @@
|
|
1
|
+
require_relative '../support/terminal'
|
2
|
+
|
1
3
|
module Vedeu
|
4
|
+
class Trigger
|
5
|
+
def self.event(event, *args)
|
6
|
+
EventRepository.trigger(event, *args)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Register
|
11
|
+
def self.event(event, *args)
|
12
|
+
EventRepository.register(event, &block)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
2
16
|
module EventRepository
|
3
17
|
extend self
|
4
18
|
|
@@ -20,7 +34,8 @@ module Vedeu
|
|
20
34
|
|
21
35
|
def defaults
|
22
36
|
{
|
23
|
-
:_exit_
|
37
|
+
:_exit_ => [ proc { fail StopIteration } ],
|
38
|
+
:_mode_switch_ => [ proc { fail ModeSwitch } ]
|
24
39
|
}
|
25
40
|
end
|
26
41
|
end
|
data/lib/vedeu/support/esc.rb
CHANGED
@@ -11,12 +11,8 @@ module Vedeu
|
|
11
11
|
["\e[48;5;", colour_translator(value), 'm'].join
|
12
12
|
end
|
13
13
|
|
14
|
-
def clear_line
|
15
|
-
"\e[2K"
|
16
|
-
end
|
17
|
-
|
18
14
|
def clear_last_line
|
19
|
-
set_position((Terminal.height - 1), 1) +
|
15
|
+
set_position((Terminal.height - 1), 1) + "\e[2K"
|
20
16
|
end
|
21
17
|
|
22
18
|
def foreground_colour(value = '#ffffff')
|
data/lib/vedeu/support/exit.rb
CHANGED
@@ -6,23 +6,31 @@ module Vedeu
|
|
6
6
|
module Terminal
|
7
7
|
extend self
|
8
8
|
# :nocov:
|
9
|
-
def open(&block)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
def open(mode, &block)
|
10
|
+
@mode = mode
|
11
|
+
|
12
|
+
if block_given?
|
13
|
+
if raw_mode?
|
14
|
+
console.raw { initialize_screen { yield } }
|
15
|
+
|
16
|
+
else
|
17
|
+
console.cooked { initialize_screen { yield } }
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
17
21
|
ensure
|
18
|
-
|
19
|
-
output Esc.string('reset')
|
20
|
-
output Esc.clear_last_line
|
22
|
+
restore_screen
|
21
23
|
end
|
22
24
|
# :nocov:
|
23
25
|
|
24
26
|
def input
|
25
|
-
|
27
|
+
if raw_mode?
|
28
|
+
console.getc
|
29
|
+
|
30
|
+
else
|
31
|
+
console.gets.chomp
|
32
|
+
|
33
|
+
end
|
26
34
|
end
|
27
35
|
|
28
36
|
def output(stream = '')
|
@@ -31,6 +39,38 @@ module Vedeu
|
|
31
39
|
stream
|
32
40
|
end
|
33
41
|
|
42
|
+
def initialize_screen(&block)
|
43
|
+
output Esc.string 'reset'
|
44
|
+
output Esc.string 'clear'
|
45
|
+
output Esc.string 'hide_cursor'
|
46
|
+
|
47
|
+
yield
|
48
|
+
end
|
49
|
+
|
50
|
+
def restore_screen
|
51
|
+
output Esc.string 'show_cursor'
|
52
|
+
output Esc.string 'reset'
|
53
|
+
output Esc.clear_last_line
|
54
|
+
end
|
55
|
+
|
56
|
+
def set_cursor_mode
|
57
|
+
output Esc.string 'show_cursor' unless raw_mode?
|
58
|
+
end
|
59
|
+
|
60
|
+
def mode_switch
|
61
|
+
if raw_mode?
|
62
|
+
Application.start({ mode: :cooked })
|
63
|
+
|
64
|
+
else
|
65
|
+
Application.start({ mode: :raw })
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def raw_mode?
|
71
|
+
@mode == :raw
|
72
|
+
end
|
73
|
+
|
34
74
|
def centre
|
35
75
|
[(height / 2), (width / 2)]
|
36
76
|
end
|
data/test/example_app/lib/app.rb
CHANGED
@@ -13,18 +13,12 @@ module Example
|
|
13
13
|
"name": "example",
|
14
14
|
"lines": {
|
15
15
|
"streams": [
|
16
|
-
{
|
17
|
-
"text": "Some text..."
|
18
|
-
},
|
19
|
-
{
|
20
|
-
"text": " "
|
21
|
-
},
|
22
16
|
{
|
23
17
|
"colour": {
|
24
18
|
"foreground": "#00ff00",
|
25
19
|
"background": "#0000ff"
|
26
20
|
},
|
27
|
-
"text": "The time is: #{Time.now}."
|
21
|
+
"text": "The time is: #{Time.now}. "
|
28
22
|
}
|
29
23
|
]
|
30
24
|
}
|
@@ -37,7 +31,11 @@ module Example
|
|
37
31
|
include Vedeu
|
38
32
|
|
39
33
|
def self.example_position
|
40
|
-
@_position = Vedeu::Coordinate.new({
|
34
|
+
@_position = Vedeu::Coordinate.new({
|
35
|
+
width: 40,
|
36
|
+
height: 2,
|
37
|
+
centered: true
|
38
|
+
}).position
|
41
39
|
end
|
42
40
|
|
43
41
|
def self.command_position
|
@@ -47,9 +47,9 @@ module Vedeu
|
|
47
47
|
attributes = JSON.load(json, nil, symbolize_names: true)
|
48
48
|
|
49
49
|
Composition.new(attributes).to_s.must_equal(
|
50
|
-
"\e[3;3H " \
|
51
|
-
"\e[4;3H " \
|
52
|
-
"\e[5;3H " \
|
50
|
+
"\e[3;3H \e[3;3H" \
|
51
|
+
"\e[4;3H \e[4;3H" \
|
52
|
+
"\e[5;3H \e[5;3H" \
|
53
53
|
"\e[3;3HSome text..."
|
54
54
|
)
|
55
55
|
end
|
@@ -60,9 +60,9 @@ module Vedeu
|
|
60
60
|
attributes = JSON.load(json, nil, symbolize_names: true)
|
61
61
|
|
62
62
|
Composition.new(attributes).to_s.must_equal(
|
63
|
-
"\e[3;3H " \
|
64
|
-
"\e[4;3H " \
|
65
|
-
"\e[5;3H " \
|
63
|
+
"\e[3;3H \e[3;3H" \
|
64
|
+
"\e[4;3H \e[4;3H" \
|
65
|
+
"\e[5;3H \e[5;3H" \
|
66
66
|
"\e[3;3HSome text... more text..."
|
67
67
|
)
|
68
68
|
end
|
@@ -73,9 +73,9 @@ module Vedeu
|
|
73
73
|
attributes = JSON.load(json, nil, symbolize_names: true)
|
74
74
|
|
75
75
|
Composition.new(attributes).to_s.must_equal(
|
76
|
-
"\e[3;3H " \
|
77
|
-
"\e[4;3H " \
|
78
|
-
"\e[5;3H " \
|
76
|
+
"\e[3;3H \e[3;3H" \
|
77
|
+
"\e[4;3H \e[4;3H" \
|
78
|
+
"\e[5;3H \e[5;3H" \
|
79
79
|
"\e[3;3HSome text..." \
|
80
80
|
"\e[4;3HSome text..."
|
81
81
|
)
|
@@ -87,9 +87,9 @@ module Vedeu
|
|
87
87
|
attributes = JSON.load(json, nil, symbolize_names: true)
|
88
88
|
|
89
89
|
Composition.new(attributes).to_s.must_equal(
|
90
|
-
"\e[3;3H " \
|
91
|
-
"\e[4;3H " \
|
92
|
-
"\e[5;3H " \
|
90
|
+
"\e[3;3H \e[3;3H" \
|
91
|
+
"\e[4;3H \e[4;3H" \
|
92
|
+
"\e[5;3H \e[5;3H" \
|
93
93
|
"\e[3;3HSome text... more text..." \
|
94
94
|
"\e[4;3HSome text... more text..."
|
95
95
|
)
|
@@ -101,9 +101,9 @@ module Vedeu
|
|
101
101
|
InterfaceRepository.create({ name: 'int1_lin2_str3_styles', y: 3, x: 3, width: 10, height: 3 })
|
102
102
|
|
103
103
|
Composition.new(attributes).to_s.must_equal(
|
104
|
-
"\e[3;3H " \
|
105
|
-
"\e[4;3H " \
|
106
|
-
"\e[5;3H " \
|
104
|
+
"\e[3;3H \e[3;3H" \
|
105
|
+
"\e[4;3H \e[4;3H" \
|
106
|
+
"\e[5;3H \e[5;3H" \
|
107
107
|
"\e[3;3H\e[38;5;16m\e[48;5;21m\e[24m\e[21m\e[27m\e[4mSome text...\e[38;5;226m\e[48;5;46m\e[24m\e[21m\e[27m \e[38;5;231m\e[48;5;201m\e[1mmore text..."
|
108
108
|
)
|
109
109
|
end
|
@@ -115,13 +115,13 @@ module Vedeu
|
|
115
115
|
attributes = JSON.load(json, nil, symbolize_names: true)
|
116
116
|
|
117
117
|
Composition.new(attributes).to_s.must_equal(
|
118
|
-
"\e[3;3H " \
|
119
|
-
"\e[4;3H " \
|
120
|
-
"\e[5;3H " \
|
118
|
+
"\e[3;3H \e[3;3H" \
|
119
|
+
"\e[4;3H \e[4;3H" \
|
120
|
+
"\e[5;3H \e[5;3H" \
|
121
121
|
"\e[3;3HSome text..." \
|
122
|
-
"\e[6;6H " \
|
123
|
-
"\e[7;6H " \
|
124
|
-
"\e[8;6H " \
|
122
|
+
"\e[6;6H \e[6;6H" \
|
123
|
+
"\e[7;6H \e[7;6H" \
|
124
|
+
"\e[8;6H \e[8;6H" \
|
125
125
|
"\e[6;6HSome text..."
|
126
126
|
)
|
127
127
|
end
|
@@ -133,13 +133,13 @@ module Vedeu
|
|
133
133
|
attributes = JSON.load(json, nil, symbolize_names: true)
|
134
134
|
|
135
135
|
Composition.new(attributes).to_s.must_equal(
|
136
|
-
"\e[3;3H " \
|
137
|
-
"\e[4;3H " \
|
138
|
-
"\e[5;3H " \
|
136
|
+
"\e[3;3H \e[3;3H" \
|
137
|
+
"\e[4;3H \e[4;3H" \
|
138
|
+
"\e[5;3H \e[5;3H" \
|
139
139
|
"\e[3;3HSome text... more text..." \
|
140
|
-
"\e[6;6H " \
|
141
|
-
"\e[7;6H " \
|
142
|
-
"\e[8;6H " \
|
140
|
+
"\e[6;6H \e[6;6H" \
|
141
|
+
"\e[7;6H \e[7;6H" \
|
142
|
+
"\e[8;6H \e[8;6H" \
|
143
143
|
"\e[6;6HSome text... more text..."
|
144
144
|
)
|
145
145
|
end
|
@@ -151,14 +151,14 @@ module Vedeu
|
|
151
151
|
attributes = JSON.load(json, nil, symbolize_names: true)
|
152
152
|
|
153
153
|
Composition.new(attributes).to_s.must_equal(
|
154
|
-
"\e[3;3H " \
|
155
|
-
"\e[4;3H " \
|
156
|
-
"\e[5;3H " \
|
154
|
+
"\e[3;3H \e[3;3H" \
|
155
|
+
"\e[4;3H \e[4;3H" \
|
156
|
+
"\e[5;3H \e[5;3H" \
|
157
157
|
"\e[3;3HSome text..." \
|
158
158
|
"\e[4;3HSome text..." \
|
159
|
-
"\e[3;3H " \
|
160
|
-
"\e[4;3H " \
|
161
|
-
"\e[5;3H " \
|
159
|
+
"\e[3;3H \e[3;3H" \
|
160
|
+
"\e[4;3H \e[4;3H" \
|
161
|
+
"\e[5;3H \e[5;3H" \
|
162
162
|
"\e[3;3HSome text..." \
|
163
163
|
"\e[4;3HSome text..."
|
164
164
|
)
|
@@ -171,14 +171,14 @@ module Vedeu
|
|
171
171
|
attributes = JSON.load(json, nil, symbolize_names: true)
|
172
172
|
|
173
173
|
Composition.new(attributes).to_s.must_equal(
|
174
|
-
"\e[3;3H " \
|
175
|
-
"\e[4;3H " \
|
176
|
-
"\e[5;3H " \
|
174
|
+
"\e[3;3H \e[3;3H" \
|
175
|
+
"\e[4;3H \e[4;3H" \
|
176
|
+
"\e[5;3H \e[5;3H" \
|
177
177
|
"\e[3;3HSome text... more text..." \
|
178
178
|
"\e[4;3HSome text... more text..." \
|
179
|
-
"\e[6;6H " \
|
180
|
-
"\e[7;6H " \
|
181
|
-
"\e[8;6H " \
|
179
|
+
"\e[6;6H \e[6;6H" \
|
180
|
+
"\e[7;6H \e[7;6H" \
|
181
|
+
"\e[8;6H \e[8;6H" \
|
182
182
|
"\e[6;6HSome text... more text..." \
|
183
183
|
"\e[7;6HSome text... more text..."
|
184
184
|
)
|
@@ -191,14 +191,14 @@ module Vedeu
|
|
191
191
|
attributes = JSON.load(json, nil, symbolize_names: true)
|
192
192
|
|
193
193
|
Composition.new(attributes).to_s.must_equal(
|
194
|
-
"\e[3;3H " \
|
195
|
-
"\e[4;3H " \
|
196
|
-
"\e[5;3H " \
|
194
|
+
"\e[3;3H \e[3;3H" \
|
195
|
+
"\e[4;3H \e[4;3H" \
|
196
|
+
"\e[5;3H \e[5;3H" \
|
197
197
|
"\e[3;3H\e[38;5;16m\e[48;5;21m\e[24m\e[21m\e[27m\e[4mSome text...\e[38;5;226m\e[48;5;46m\e[24m\e[21m\e[27m \e[38;5;231m\e[48;5;201m\e[1mmore text..." \
|
198
198
|
"\e[4;3H\e[38;5;16m\e[48;5;21m\e[24m\e[21m\e[27m\e[4mSome text...\e[38;5;226m\e[48;5;46m\e[24m\e[21m\e[27m \e[38;5;231m\e[48;5;201m\e[1mmore text..." \
|
199
|
-
"\e[6;6H " \
|
200
|
-
"\e[7;6H " \
|
201
|
-
"\e[8;6H " \
|
199
|
+
"\e[6;6H \e[6;6H" \
|
200
|
+
"\e[7;6H \e[7;6H" \
|
201
|
+
"\e[8;6H \e[8;6H" \
|
202
202
|
"\e[6;6H\e[38;5;16m\e[48;5;21m\e[24m\e[21m\e[27m\e[4mSome text...\e[38;5;226m\e[48;5;46m\e[24m\e[21m\e[27m \e[38;5;231m\e[48;5;201m\e[1mmore text..." \
|
203
203
|
"\e[7;6H\e[38;5;16m\e[48;5;21m\e[24m\e[21m\e[27m\e[4mSome text...\e[38;5;226m\e[48;5;46m\e[24m\e[21m\e[27m \e[38;5;231m\e[48;5;201m\e[1mmore text..."
|
204
204
|
)
|
@@ -103,9 +103,9 @@ module Vedeu
|
|
103
103
|
it 'returns a blank interface when there is no content to display (initial state)' do
|
104
104
|
Interface.new(attributes).refresh.must_equal(
|
105
105
|
"\e[38;5;196m\e[48;5;16m" \
|
106
|
-
"\e[1;1H " \
|
107
|
-
"\e[2;1H " \
|
108
|
-
"\e[3;1H "
|
106
|
+
"\e[1;1H \e[1;1H" \
|
107
|
+
"\e[2;1H \e[2;1H" \
|
108
|
+
"\e[3;1H \e[3;1H"
|
109
109
|
)
|
110
110
|
end
|
111
111
|
|
@@ -129,9 +129,9 @@ module Vedeu
|
|
129
129
|
|
130
130
|
interface.refresh.must_equal(
|
131
131
|
"\e[38;5;196m\e[48;5;16m" \
|
132
|
-
"\e[1;1H " \
|
133
|
-
"\e[2;1H " \
|
134
|
-
"\e[3;1H " \
|
132
|
+
"\e[1;1H \e[1;1H" \
|
133
|
+
"\e[2;1H \e[2;1H" \
|
134
|
+
"\e[3;1H \e[3;1H" \
|
135
135
|
"\e[1;1H#refresh" \
|
136
136
|
"\e[2;1H#refresh" \
|
137
137
|
"\e[3;1H#refresh"
|
@@ -151,18 +151,18 @@ module Vedeu
|
|
151
151
|
}
|
152
152
|
interface = Interface.new(attributes)
|
153
153
|
interface.current = "\e[38;5;196m\e[48;5;16m" \
|
154
|
-
"\e[1;1H " \
|
155
|
-
"\e[2;1H " \
|
156
|
-
"\e[3;1H " \
|
154
|
+
"\e[1;1H \e[1;1H" \
|
155
|
+
"\e[2;1H \e[2;1H" \
|
156
|
+
"\e[3;1H \e[3;1H" \
|
157
157
|
"\e[1;1H#refresh" \
|
158
158
|
"\e[2;1H#refresh" \
|
159
159
|
"\e[3;1H#refresh"
|
160
160
|
|
161
161
|
interface.refresh.must_equal(
|
162
162
|
"\e[38;5;196m\e[48;5;16m" \
|
163
|
-
"\e[1;1H " \
|
164
|
-
"\e[2;1H " \
|
165
|
-
"\e[3;1H " \
|
163
|
+
"\e[1;1H \e[1;1H" \
|
164
|
+
"\e[2;1H \e[2;1H" \
|
165
|
+
"\e[3;1H \e[3;1H" \
|
166
166
|
"\e[1;1H#refresh" \
|
167
167
|
"\e[2;1H#refresh" \
|
168
168
|
"\e[3;1H#refresh"
|
@@ -183,9 +183,9 @@ module Vedeu
|
|
183
183
|
height: 3
|
184
184
|
}).to_s.must_equal(
|
185
185
|
"\e[38;5;196m\e[48;5;16m" \
|
186
|
-
"\e[1;1H " \
|
187
|
-
"\e[2;1H " \
|
188
|
-
"\e[3;1H "
|
186
|
+
"\e[1;1H \e[1;1H" \
|
187
|
+
"\e[2;1H \e[2;1H" \
|
188
|
+
"\e[3;1H \e[3;1H"
|
189
189
|
)
|
190
190
|
end
|
191
191
|
end
|
@@ -15,8 +15,8 @@ module Vedeu
|
|
15
15
|
height: 2
|
16
16
|
})
|
17
17
|
InterfaceRenderer.clear(interface).must_equal(
|
18
|
-
"\e[1;1H " \
|
19
|
-
"\e[2;1H "
|
18
|
+
"\e[1;1H \e[1;1H" \
|
19
|
+
"\e[2;1H \e[2;1H"
|
20
20
|
)
|
21
21
|
end
|
22
22
|
|
@@ -32,8 +32,8 @@ module Vedeu
|
|
32
32
|
})
|
33
33
|
InterfaceRenderer.clear(interface).must_equal(
|
34
34
|
"\e[38;5;46m\e[48;5;226m" \
|
35
|
-
"\e[1;1H " \
|
36
|
-
"\e[2;1H "
|
35
|
+
"\e[1;1H \e[1;1H" \
|
36
|
+
"\e[2;1H \e[2;1H"
|
37
37
|
)
|
38
38
|
end
|
39
39
|
end
|
@@ -74,9 +74,9 @@ module Vedeu
|
|
74
74
|
}).enqueue
|
75
75
|
|
76
76
|
InterfaceRepository.refresh.must_equal([
|
77
|
-
"\e[1;1H \e[1;1Hbeta",
|
78
|
-
"\e[1;1H \e[1;1Hgamma",
|
79
|
-
"\e[1;1H \e[1;1Halpha"
|
77
|
+
"\e[1;1H \e[1;1H\e[1;1Hbeta",
|
78
|
+
"\e[1;1H \e[1;1H\e[1;1Hgamma",
|
79
|
+
"\e[1;1H \e[1;1H\e[1;1Halpha"
|
80
80
|
])
|
81
81
|
end
|
82
82
|
end
|
@@ -13,12 +13,6 @@ module Vedeu
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
describe '.clear_line' do
|
17
|
-
it 'returns an escape sequence' do
|
18
|
-
Esc.clear_line.must_equal("\e[2K")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
16
|
describe '.clear_last_line' do
|
23
17
|
it 'returns an escape sequence to clear the last line' do
|
24
18
|
IO.console.stub :winsize, [25, 25] do
|
@@ -19,8 +19,8 @@ module Vedeu
|
|
19
19
|
describe '#trigger' do
|
20
20
|
it 'returns a collection containing the event when the event is pre-registered' do
|
21
21
|
EventRepository.register(:some_event) { proc { |x| x } }
|
22
|
-
EventRepository.trigger(:_exit_, []).first.call
|
23
|
-
.
|
22
|
+
proc { EventRepository.trigger(:_exit_, []).first.call }
|
23
|
+
.must_raise(StopIteration)
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'returns an empty collection when the event has not been registered' do
|
@@ -4,8 +4,8 @@ require_relative '../../../../lib/vedeu/support/exit'
|
|
4
4
|
module Vedeu
|
5
5
|
describe Exit do
|
6
6
|
describe '.dispatch' do
|
7
|
-
it '
|
8
|
-
Exit.dispatch.
|
7
|
+
it 'halts execution' do
|
8
|
+
proc { Exit.dispatch }.must_raise(StopIteration)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/vedeu.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'vedeu'
|
7
|
-
spec.version = '0.0.
|
7
|
+
spec.version = '0.0.35'
|
8
8
|
spec.authors = ['Gavin Laking']
|
9
9
|
spec.email = ['gavinlaking@gmail.com']
|
10
10
|
spec.summary = %q{A terminal case of wonderland.}
|