ansi-sys 0.5.0 → 0.6.0
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.
- data/ChangeLog +9 -0
- data/History.txt +3 -0
- data/Rakefile +3 -1
- data/lib/ansisys.rb +1 -1
- data/spec/character_screen_spec.rb +2 -2
- data/spec/cursor_spec.rb +5 -5
- data/spec/lexer_spec.rb +3 -3
- data/spec/screen_spec.rb +2 -2
- data/spec/terminal_spec.rb +18 -18
- data/website/index.html +1 -1
- data/website/stylesheets/screen.css +1 -1
- metadata +1 -1
data/ChangeLog
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
* 2007-11-03 zunda <zunda at freeshell.org>
|
2
|
+
- (0.6.0)
|
3
|
+
- spec/*_spec.rb: Clarified spec documents
|
4
|
+
- Rakefile: added `spec' task as a default value
|
5
|
+
- I don't know how to remove `test' taks yet.
|
6
|
+
|
7
|
+
* 2007-11-03 zunda <zunda at freeshell.org>
|
8
|
+
- Edited website/stylesheets/screen.css
|
9
|
+
|
1
10
|
* 2007-11-03 zunda <zunda at freeshell.org>
|
2
11
|
- (0.5.0)
|
3
12
|
- Formatted RDoc
|
data/History.txt
CHANGED
data/Rakefile
CHANGED
data/lib/ansisys.rb
CHANGED
@@ -7,7 +7,7 @@ unless defined?(:SGR)
|
|
7
7
|
end
|
8
8
|
|
9
9
|
include AnsiSys
|
10
|
-
describe "
|
10
|
+
describe "Characters echoed on a Screen" do
|
11
11
|
before do
|
12
12
|
@string = "Test string <HELLO>"
|
13
13
|
@char = Characters.new(@string, SGR.new)
|
@@ -15,7 +15,7 @@ describe "Normal characters echoed on a Screen" do
|
|
15
15
|
@cursor = Cursor.new
|
16
16
|
end
|
17
17
|
|
18
|
-
it "should usually be distributed identical string onto screen" do
|
18
|
+
it "should usually be distributed as an identical string onto screen" do
|
19
19
|
@char.echo_on(@screen, @cursor)
|
20
20
|
@screen.render(:text).should == <<_SCREEN.chomp
|
21
21
|
Test string <HELLO>
|
data/spec/cursor_spec.rb
CHANGED
@@ -49,28 +49,28 @@ describe Cursor, 'when moved normally' do
|
|
49
49
|
lambda{@cursor.apply_code!('D', 2)}.should change(@cursor, :cur_col).by(-2)
|
50
50
|
end
|
51
51
|
|
52
|
-
it "should move to beggining of lower line with CNL" do
|
52
|
+
it "should move to beggining of lower line with code CNL" do
|
53
53
|
[[1, 'E'], [1, ['E', 1]], [2, ['E', 2]]].each do |d, code|
|
54
54
|
lambda{@cursor.apply_code!(*code)}.should change(@cursor, :cur_row).by(d)
|
55
55
|
@cursor.cur_col.should == 1
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
it "should move to beggining of upper line with CPL" do
|
59
|
+
it "should move to beggining of upper line with code CPL" do
|
60
60
|
[[-1, ['F']], [-1, ['F', 1]], [-2, ['F', 2]]].each do |d, code|
|
61
61
|
lambda{@cursor.apply_code!(*code)}.should change(@cursor, :cur_row).by(d)
|
62
62
|
@cursor.cur_col.should == 1
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
it "should move to specified column with CHA" do
|
66
|
+
it "should move to specified column with code CHA" do
|
67
67
|
[[1, ['G']], [1, ['G', 1]], [2, ['G', 2]]].each do |c, code|
|
68
68
|
lambda{@cursor.apply_code!(*code)}.should_not change(@cursor, :cur_row)
|
69
69
|
@cursor.cur_col.should == c
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
it "should move to specified position with CUP and HVP" do
|
73
|
+
it "should move to specified position with codes CUP and HVP" do
|
74
74
|
%w(H f).each do |letter|
|
75
75
|
[
|
76
76
|
# row, column, pars
|
@@ -131,7 +131,7 @@ describe Cursor, 'when tried to be moved beyond edge' do
|
|
131
131
|
end
|
132
132
|
|
133
133
|
describe Cursor, 'when advanced' do
|
134
|
-
it "should move to the next column
|
134
|
+
it "should move to the next column usually" do
|
135
135
|
cursor = Cursor.new(1, 1, 80, 25)
|
136
136
|
lambda{cursor.advance!}.should change(cursor, :cur_col).by(1)
|
137
137
|
[1, 2, 3].each do |w|
|
data/spec/lexer_spec.rb
CHANGED
@@ -62,13 +62,13 @@ describe Lexer do
|
|
62
62
|
@lexer.buffer.should_not be_empty
|
63
63
|
end
|
64
64
|
|
65
|
-
it 'should return string and code' do
|
65
|
+
it 'should return string and complete code' do
|
66
66
|
@lexer.push("string one\x1b[32mstring two")
|
67
67
|
@lexer.lex!.should == [[:string, 'string one'], [:code, '32m'], [:string, 'string two']]
|
68
68
|
@lexer.buffer.should be_empty
|
69
69
|
end
|
70
70
|
|
71
|
-
it 'should translate LF to a
|
71
|
+
it 'should translate LF to a code E' do
|
72
72
|
@lexer.push("line one\nline two\n")
|
73
73
|
@lexer.lex!.should == [[:string, 'line one'], [:code, 'E'], [:string, 'line two'], [:code, 'E']]
|
74
74
|
@lexer.buffer.should be_empty
|
@@ -80,7 +80,7 @@ describe Lexer do
|
|
80
80
|
@lexer.buffer.should be_empty
|
81
81
|
end
|
82
82
|
|
83
|
-
it 'should translate LFCR to a
|
83
|
+
it 'should translate LFCR to a code E' do
|
84
84
|
@lexer.push("line one\n\rline two\n\r")
|
85
85
|
@lexer.lex!.should == [[:string, 'line one'], [:code, 'E'], [:string, 'line two'], [:code, 'E']]
|
86
86
|
@lexer.buffer.should be_empty
|
data/spec/screen_spec.rb
CHANGED
@@ -17,7 +17,7 @@ describe Screen, "when rendered as a plain text" do
|
|
17
17
|
@screen.instance_variable_get(:@lines)[5][3].should == ['t', 1, SGR.new]
|
18
18
|
end
|
19
19
|
|
20
|
-
it "should overwrite character" do
|
20
|
+
it "should overwrite character at the same location" do
|
21
21
|
@screen.write('t', 1, 3, 5, @sgr)
|
22
22
|
@screen.write('u', 1, 3, 5, @sgr)
|
23
23
|
@screen.instance_variable_get(:@lines)[5][3].should == ['u', 1, SGR.new]
|
@@ -83,7 +83,7 @@ _SCREEN
|
|
83
83
|
end
|
84
84
|
|
85
85
|
describe "screen with default colors set", :shared => true do
|
86
|
-
it "should only specify colors of special color letters" do
|
86
|
+
it "should only specify colors of special color letters when rendered as HTML" do
|
87
87
|
@screen.render(:html).should == <<_SCREEN.chomp
|
88
88
|
<pre class="screen">\n<span style="color: green">:)</span>hello</pre>
|
89
89
|
_SCREEN
|
data/spec/terminal_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'ansisys'
|
|
3
3
|
|
4
4
|
include AnsiSys
|
5
5
|
|
6
|
-
describe Terminal, "when ascii
|
6
|
+
describe Terminal, "when normal ascii characters are echoed" do
|
7
7
|
before do
|
8
8
|
@terminal = Terminal.new
|
9
9
|
@terminal.echo("Hello world")
|
@@ -87,27 +87,27 @@ describe Terminal, 'when code ED is sent' do
|
|
87
87
|
@terminal.echo("Hello\nand\ngood bye\nworld\e[2;2H")
|
88
88
|
end
|
89
89
|
|
90
|
-
it 'should clear from cursor to end of screen with J' do
|
90
|
+
it 'should clear from cursor to end of screen with a code J' do
|
91
91
|
@terminal.echo("\e[J")
|
92
92
|
@terminal.render(:text).should == "Hello\na"
|
93
93
|
end
|
94
94
|
|
95
|
-
it 'should clear from cursor to end of screen with 0J' do
|
95
|
+
it 'should clear from cursor to end of screen with a code 0J' do
|
96
96
|
@terminal.echo("\e[0J")
|
97
97
|
@terminal.render(:text).should == "Hello\na"
|
98
98
|
end
|
99
99
|
|
100
|
-
it 'should clear from cursor to beggining of screen with 1J' do
|
100
|
+
it 'should clear from cursor to beggining of screen with a code 1J' do
|
101
101
|
@terminal.echo("\e[1J")
|
102
102
|
@terminal.render(:text).should == "\n d\ngood bye\nworld"
|
103
103
|
end
|
104
104
|
|
105
|
-
it 'should clear entier screen with 2J' do
|
105
|
+
it 'should clear entier screen with a code 2J' do
|
106
106
|
@terminal.echo("\e[2J")
|
107
107
|
@terminal.render(:text).should == ""
|
108
108
|
end
|
109
109
|
|
110
|
-
it 'should move cursor to top left with 2J' do
|
110
|
+
it 'should move cursor to top left with a code 2J' do
|
111
111
|
@terminal.echo("\e[2JX")
|
112
112
|
@terminal.render(:text).should == "X"
|
113
113
|
end
|
@@ -119,27 +119,27 @@ describe Terminal, 'when code EL is sent' do
|
|
119
119
|
@terminal.echo("red\ngreen\nrefactor\e[2;2H")
|
120
120
|
end
|
121
121
|
|
122
|
-
it 'should clear from cursor to end of line with K' do
|
122
|
+
it 'should clear from cursor to end of line with a code K' do
|
123
123
|
@terminal.echo("\e[K")
|
124
124
|
@terminal.render(:text).should == "red\ng\nrefactor"
|
125
125
|
end
|
126
126
|
|
127
|
-
it 'should clear from cursor to end of line with K' do
|
127
|
+
it 'should clear from cursor to end of line with a code K' do
|
128
128
|
@terminal.echo("\e[0K")
|
129
129
|
@terminal.render(:text).should == "red\ng\nrefactor"
|
130
130
|
end
|
131
131
|
|
132
|
-
it 'should clear from cursor to beginning of line with K' do
|
132
|
+
it 'should clear from cursor to beginning of line with a code K' do
|
133
133
|
@terminal.echo("\e[1K")
|
134
134
|
@terminal.render(:text).should == "red\n een\nrefactor"
|
135
135
|
end
|
136
136
|
|
137
|
-
it 'should clear entier line with 2K' do
|
137
|
+
it 'should clear entier line with a code 2K' do
|
138
138
|
@terminal.echo("\e[2K")
|
139
139
|
@terminal.render(:text).should == "red\n\nrefactor"
|
140
140
|
end
|
141
141
|
|
142
|
-
it 'should not move cursor with 2K' do
|
142
|
+
it 'should not move cursor with a code 2K' do
|
143
143
|
@terminal.echo("\e[2KX")
|
144
144
|
@terminal.render(:text).should == "red\n X\nrefactor"
|
145
145
|
end
|
@@ -151,17 +151,17 @@ describe Terminal, 'when code SU is sent' do
|
|
151
151
|
@terminal.echo("red\ngreen\n\nrefactor\e[2;2H")
|
152
152
|
end
|
153
153
|
|
154
|
-
it 'shuold scroll down by one line with S' do
|
154
|
+
it 'shuold scroll down by one line with a code S' do
|
155
155
|
@terminal.echo("\e[S")
|
156
156
|
@terminal.render(:text).should == "green\n\nrefactor"
|
157
157
|
end
|
158
158
|
|
159
|
-
it 'shuold scroll down by one line with 1S' do
|
159
|
+
it 'shuold scroll down by one line with a code 1S' do
|
160
160
|
@terminal.echo("\e[1S")
|
161
161
|
@terminal.render(:text).should == "green\n\nrefactor"
|
162
162
|
end
|
163
163
|
|
164
|
-
it 'shuold scroll down by two lines with 2S' do
|
164
|
+
it 'shuold scroll down by two lines with a code 2S' do
|
165
165
|
@terminal.echo("\e[2S")
|
166
166
|
@terminal.render(:text).should == "\nrefactor"
|
167
167
|
end
|
@@ -178,17 +178,17 @@ describe Terminal, 'when code SD is sent' do
|
|
178
178
|
@terminal.echo("red\ngreen\n\nrefactor\e[2;2H")
|
179
179
|
end
|
180
180
|
|
181
|
-
it 'shuold scroll up by one line with T' do
|
181
|
+
it 'shuold scroll up by one line with a code T' do
|
182
182
|
@terminal.echo("\e[T")
|
183
183
|
@terminal.render(:text).should == "\nred\ngreen\n\nrefactor"
|
184
184
|
end
|
185
185
|
|
186
|
-
it 'shuold scroll up by one line with 1T' do
|
186
|
+
it 'shuold scroll up by one line with a code 1T' do
|
187
187
|
@terminal.echo("\e[1T")
|
188
188
|
@terminal.render(:text).should == "\nred\ngreen\n\nrefactor"
|
189
189
|
end
|
190
190
|
|
191
|
-
it 'shuold scroll up by two lines with 2T' do
|
191
|
+
it 'shuold scroll up by two lines with a code 2T' do
|
192
192
|
@terminal.echo("\e[2T")
|
193
193
|
@terminal.render(:text).should == "\n\nred\ngreen\n\nrefactor"
|
194
194
|
end
|
@@ -199,7 +199,7 @@ describe Terminal, 'when code SD is sent' do
|
|
199
199
|
end
|
200
200
|
end
|
201
201
|
|
202
|
-
describe Terminal, 'when code SCP
|
202
|
+
describe Terminal, 'when code SCP or RCP is sent' do
|
203
203
|
before do
|
204
204
|
@terminal = Terminal.new
|
205
205
|
@terminal.echo("red\ngreen\nrefactor\e[2;2H")
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>Ruby-ANSI.SYS</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/ansi-sys"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/ansi-sys" class="numbers">0.
|
36
|
+
<a href="http://rubyforge.org/projects/ansi-sys" class="numbers">0.6.0</a>
|
37
37
|
</div>
|
38
38
|
<h2>What</h2>
|
39
39
|
|
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ansi-sys
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
6
|
+
version: 0.6.0
|
7
7
|
date: 2007-11-03 00:00:00 -10:00
|
8
8
|
summary: Ruby-ANSI.SYS is a library to render texts with ANSI escape sequences.
|
9
9
|
require_paths:
|