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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab3e019fddbb91543e5e6cfcabdb3fa5e7ba9eee
4
- data.tar.gz: 2a1beb7ebf58c777fde4c9092be162e721ab6a2f
3
+ metadata.gz: 23195e489d60c01aae24ad6398374fe4c3dffe42
4
+ data.tar.gz: 5b16b43ca2729ab6c01f73cdcc1a6e0ed8a6dc68
5
5
  SHA512:
6
- metadata.gz: f481380fc4e9e021a96f0e9c463a57bed2f9fb8e6035edf0da5072037d6c61e6f5df05a783fdbd2b4d1bf1a635e73ca24f3c01ed1fb6f8bbe8a9376c123e95e7
7
- data.tar.gz: 0bd767c2d2bc1d6d5060fe406984b18d310880cff655df120556d25ce20cf85f6d993ebf876f1dec53b1f716a5c17d14361b893bfc1bdc22f0bfd8d58ae04c25
6
+ metadata.gz: cee8876c8723e1ae9d166ad0c1a7592a63ff0b07bf39ca494887cc9c72678a4c63531db589cd2422bd6f44fd3820231320bebcd82c2222e21095bd8156673b04
7
+ data.tar.gz: a058245a4c1aab1b257c3d2a585de7c587e90369d2ac7cb36c3241f1278a0419c4aedc1b36bfe313a54e26d12f74cbe2d382f37e755c651cd2f04b799508f459
@@ -1,4 +1,7 @@
1
+ ---
1
2
  language: ruby
3
+ sudo: false
4
+ cache: bundler
2
5
  bundler_args: --without yard benchmarks
3
6
  script: "bundle exec rake ci"
4
7
  rvm:
@@ -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 lines up and 2 rows to the right do:
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.right(2)
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:
@@ -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 << dir + clear_line
141
+ acc << clear_line + ((i == count - 1) ? '' : dir)
142
142
  end
143
143
  end
144
144
  alias_method :clear_rows, :clear_lines
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TTY
4
4
  module Cursor
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
  end # Cursor
7
7
  end # TTY
@@ -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[1A\e[1000D\e[K",
13
- "\e[1A\e[1000D\e[K",
14
- "\e[1A\e[1000D\e[K",
15
- "\e[1A\e[1000D\e[K",
16
- "\e[1A\e[1000D\e[K"
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[1B\e[1000D\e[K",
23
- "\e[1B\e[1000D\e[K",
24
- "\e[1B\e[1000D\e[K",
25
- "\e[1B\e[1000D\e[K",
26
- "\e[1B\e[1000D\e[K"
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.1.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-28 00:00:00.000000000 Z
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