tty-cursor 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/CHANGELOG.md +13 -0
- data/README.md +2 -2
- data/lib/tty/cursor.rb +2 -2
- data/lib/tty/version.rb +1 -1
- data/spec/unit/clear_lines_spec.rb +10 -10
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23195e489d60c01aae24ad6398374fe4c3dffe42
|
4
|
+
data.tar.gz: 5b16b43ca2729ab6c01f73cdcc1a6e0ed8a6dc68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cee8876c8723e1ae9d166ad0c1a7592a63ff0b07bf39ca494887cc9c72678a4c63531db589cd2422bd6f44fd3820231320bebcd82c2222e21095bd8156673b04
|
7
|
+
data.tar.gz: a058245a4c1aab1b257c3d2a585de7c587e90369d2ac7cb36c3241f1278a0419c4aedc1b36bfe313a54e26d12f74cbe2d382f37e755c651cd2f04b799508f459
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Change log
|
2
|
+
|
3
|
+
## [v0.2.0] - 2015-12-28
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
* Change #clear_lines to clear first and move up/down
|
7
|
+
|
8
|
+
## [v0.1.0] - 2015-11-28
|
9
|
+
|
10
|
+
* Initial implementation and release
|
11
|
+
|
12
|
+
[v0.2.0]: https://github.com/peter-murach/tty-cursor/compare/v0.1.0...v0.2.0
|
13
|
+
[v0.1.0]: https://github.com/peter-murach/tty-cursor/compare/v0.1.0
|
data/README.md
CHANGED
@@ -67,10 +67,10 @@ Or install it yourself as:
|
|
67
67
|
cursor = TTY::Cursor
|
68
68
|
```
|
69
69
|
|
70
|
-
and then to move cursor 5
|
70
|
+
and then to move cursor 5 rows up and 2 columns forward do:
|
71
71
|
|
72
72
|
```ruby
|
73
|
-
print cursor.up(5) + cursor.
|
73
|
+
print cursor.up(5) + cursor.forward(2)
|
74
74
|
```
|
75
75
|
|
76
76
|
or simple call `move` to move cursor relative to current position:
|
data/lib/tty/cursor.rb
CHANGED
@@ -136,9 +136,9 @@ module TTY
|
|
136
136
|
#
|
137
137
|
# @api public
|
138
138
|
def clear_lines(count, direction = :up)
|
139
|
-
count.times.reduce('') do |acc|
|
139
|
+
count.times.reduce('') do |acc, i|
|
140
140
|
dir = direction == :up ? up : down
|
141
|
-
acc <<
|
141
|
+
acc << clear_line + ((i == count - 1) ? '' : dir)
|
142
142
|
end
|
143
143
|
end
|
144
144
|
alias_method :clear_rows, :clear_lines
|
data/lib/tty/version.rb
CHANGED
@@ -9,21 +9,21 @@ RSpec.describe TTY::Cursor, '#clear_lines' do
|
|
9
9
|
|
10
10
|
it "clears 5 lines up" do
|
11
11
|
expect(cursor.clear_lines(5)).to eq([
|
12
|
-
"\e[
|
13
|
-
"\e[
|
14
|
-
"\e[
|
15
|
-
"\e[
|
16
|
-
"\e[
|
12
|
+
"\e[1000D\e[K\e[1A",
|
13
|
+
"\e[1000D\e[K\e[1A",
|
14
|
+
"\e[1000D\e[K\e[1A",
|
15
|
+
"\e[1000D\e[K\e[1A",
|
16
|
+
"\e[1000D\e[K"
|
17
17
|
].join)
|
18
18
|
end
|
19
19
|
|
20
20
|
it "clears 5 lines down" do
|
21
21
|
expect(cursor.clear_lines(5, :down)).to eq([
|
22
|
-
"\e[
|
23
|
-
"\e[
|
24
|
-
"\e[
|
25
|
-
"\e[
|
26
|
-
"\e[
|
22
|
+
"\e[1000D\e[K\e[1B",
|
23
|
+
"\e[1000D\e[K\e[1B",
|
24
|
+
"\e[1000D\e[K\e[1B",
|
25
|
+
"\e[1000D\e[K\e[1B",
|
26
|
+
"\e[1000D\e[K"
|
27
27
|
].join)
|
28
28
|
end
|
29
29
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tty-cursor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- .rspec
|
37
37
|
- .ruby-version
|
38
38
|
- .travis.yml
|
39
|
+
- CHANGELOG.md
|
39
40
|
- Gemfile
|
40
41
|
- LICENSE.txt
|
41
42
|
- README.md
|