tty-cursor 0.6.1 → 0.7.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
  SHA256:
3
- metadata.gz: 57fcf44408793c8b1b7b804e6dea8618b2dbc21e4fbe562c2d4b54e065dc8274
4
- data.tar.gz: e7f8709d0d35f8f235357e000c4b90f4d783fc7b7bdf9dff5131939281319cbd
3
+ metadata.gz: c6621ad96826f2ad35be6c0f8dc2c68871109db0a550958a50849c657bef1c9f
4
+ data.tar.gz: 3d1808171b01aed1c46a14fdc0c75ed17aaf6781dcd96ece09b9e41af603d298
5
5
  SHA512:
6
- metadata.gz: 9a2894c83345b6392d66fe9addefebfe1e8e982106ddd683ddfc24ac7f4e5de4e76a7e98a50d74a9118378c477155ed52961aeb9f0ed93244338be25190c4e10
7
- data.tar.gz: 614ce96b7fd55b37d85e3bd957fe3adef839f71751414c686c4aeae8edcb904ad7e5b43a0cc5890fbc5dd815a9fe619e476bf22b99f9e3d87dbafa16b696ef08
6
+ metadata.gz: f9a294dbee365a732d9b60cc80d1d3e200ba33ec85b7c8bc6344e9b03e83483a7d8121b0bc29fc6d6c741d5c992db249b0bedffa23322917e8aca7db4973518a
7
+ data.tar.gz: 571d07e6127a46ea902f2f22e48b0e6084cf1a80d7dbd48837fbadf72d257864e9edf4222b47d3d5621c6dd5f5fa8d0ceedd77426e569ec8c7ab3c4cb2759684
@@ -1,5 +1,13 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.7.0] - 2019-05-27
4
+
5
+ ### Added
6
+ * Add #scroll_up & #scroll_down display by one line
7
+
8
+ ### Changed
9
+ * Change to restrict gem to Ruby >= 2.0
10
+
3
11
  ## [v0.6.1] - 2019-02-28
4
12
 
5
13
  ### Changed
@@ -51,6 +59,7 @@
51
59
 
52
60
  * Initial implementation and release
53
61
 
62
+ [v0.7.0]: https://github.com/piotrmurach/tty-cursor/compare/v0.6.1...v0.7.0
54
63
  [v0.6.1]: https://github.com/piotrmurach/tty-cursor/compare/v0.6.0...v0.6.1
55
64
  [v0.6.0]: https://github.com/piotrmurach/tty-cursor/compare/v0.5.0...v0.6.0
56
65
  [v0.5.0]: https://github.com/piotrmurach/tty-cursor/compare/v0.4.0...v0.5.0
data/README.md CHANGED
@@ -63,7 +63,7 @@ Or install it yourself as:
63
63
  * [2.2.1 show](#221-show)
64
64
  * [2.2.2 hide](#222-hide)
65
65
  * [2.2.3 invisible(stream)](#223-invisiblestream)
66
- * [2.3 Text Modification](#23-text-modification)
66
+ * [2.3 Text Clearing](#23-text-clearing)
67
67
  * [2.3.1 clear_char(n)](#231-clear_charn)
68
68
  * [2.3.2 clear_line](#232-clear_line)
69
69
  * [2.3.3 clear_line_before](#233-clear_line_before)
@@ -72,6 +72,9 @@ Or install it yourself as:
72
72
  * [2.3.6 clear_screen_down](#236-clear_screen_down)
73
73
  * [2.3.7 clear_screen_up](#237-clear_screen_up)
74
74
  * [2.3.8 clear_screen](#238-clear_screen)
75
+ * [2.4 Scrolling](#24-scrolling)
76
+ * [2.4.1 scroll_down](#241-scroll_down)
77
+ * [2.4.2 scroll_up](#242-scroll_up)
75
78
 
76
79
  ## 1. Usage
77
80
 
@@ -143,7 +146,7 @@ Cursor moves to `<n>`th position horizontally in the current line.
143
146
 
144
147
  #### 2.1.8 row(n)
145
148
 
146
- Cursor moves the the `<n>`th position vertically in the current column.
149
+ Cursor moves to the `<n>`th position vertically in the current column.
147
150
 
148
151
  #### 2.1.9 next_line
149
152
 
@@ -191,13 +194,13 @@ By default standard output will be used but you can change that by passing a dif
191
194
  cursor.invisible($stderr) { .... }
192
195
  ```
193
196
 
194
- ### 2.3 Text Modification
197
+ ### 2.3 Text Clearing
195
198
 
196
199
  All methods in this section provide APIs to modify text buffer contents.
197
200
 
198
201
  #### 2.3.1 clear_char(n)
199
202
 
200
- Erase `<n>` characters from the current cursor position by overwritting them with space character.
203
+ Erase `<n>` characters from the current cursor position by overwriting them with space character.
201
204
 
202
205
  #### 2.3.2 clear_line
203
206
 
@@ -231,6 +234,17 @@ Erase the screen from the current line down to the bottom of the screen.
231
234
 
232
235
  Erase the screen from the current line up to the top of the screen.
233
236
 
237
+ ### 2.4 Scrolling
238
+
239
+ #### 2.4.1 scroll_down
240
+
241
+ Scroll display down one line.
242
+
243
+ ### 2.4.2 scroll_up
244
+
245
+ Scroll display up one line.
246
+
247
+
234
248
  ## Contributing
235
249
 
236
250
  1. Fork it ( https://github.com/piotrmurach/tty-cursor/fork )
@@ -191,5 +191,17 @@ module TTY
191
191
  def clear_screen
192
192
  CSI + '2J'
193
193
  end
194
+
195
+ # Scroll display up one line
196
+ # @api public
197
+ def scroll_up
198
+ ESC + 'M'
199
+ end
200
+
201
+ # Scroll display down one line
202
+ # @api public
203
+ def scroll_down
204
+ ESC + 'D'
205
+ end
194
206
  end # Cursor
195
207
  end # TTY
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TTY
4
4
  module Cursor
5
- VERSION = '0.6.1'
5
+ VERSION = '0.7.0'
6
6
  end # Cursor
7
7
  end # TTY
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- if RUBY_VERSION > '1.9' and (ENV['COVERAGE'] || ENV['TRAVIS'])
3
+ if ENV['COVERAGE'] || ENV['TRAVIS']
4
4
  require 'simplecov'
5
5
  require 'coveralls'
6
6
 
7
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
7
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
8
8
  SimpleCov::Formatter::HTMLFormatter,
9
9
  Coveralls::SimpleCov::Formatter
10
- ]
10
+ ])
11
11
 
12
12
  SimpleCov.start do
13
13
  command_name 'spec'
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe TTY::Cursor do
4
+ subject(:cursor) { described_class }
5
+
6
+ it "scrolls down by one line" do
7
+ expect(cursor.scroll_down).to eq("\eD")
8
+ end
9
+
10
+ it "scrolls up by one line" do
11
+ expect(cursor.scroll_up).to eq("\eM")
12
+ end
13
+ end
@@ -1,10 +1,11 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
- desc 'Load gem inside irb console'
3
+ desc "Load gem inside irb console"
4
4
  task :console do
5
5
  require 'irb'
6
6
  require 'irb/completion'
7
- require File.join(__FILE__, '../../lib/pastel')
7
+ require File.join(__FILE__, '../../lib/tty-cursor')
8
8
  ARGV.clear
9
9
  IRB.start
10
10
  end
11
+ task c: %w[ console ]
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  desc 'Measure code coverage'
4
4
  task :coverage do
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  begin
4
4
  require 'rspec/core/rake_task'
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
+ spec.required_ruby_version = '>= 2.0.0'
23
+
22
24
  spec.add_development_dependency 'bundler', '>= 1.6'
23
25
  spec.add_development_dependency 'rspec', '~> 3.1'
24
26
  spec.add_development_dependency 'rake'
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.6.1
4
+ version: 0.7.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: 2019-02-28 00:00:00.000000000 Z
11
+ date: 2019-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,6 +72,7 @@ files:
72
72
  - spec/unit/cursor_spec.rb
73
73
  - spec/unit/move_spec.rb
74
74
  - spec/unit/move_to_spec.rb
75
+ - spec/unit/scroll_spec.rb
75
76
  - tasks/console.rake
76
77
  - tasks/coverage.rake
77
78
  - tasks/spec.rake
@@ -88,15 +89,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
89
  requirements:
89
90
  - - ">="
90
91
  - !ruby/object:Gem::Version
91
- version: '0'
92
+ version: 2.0.0
92
93
  required_rubygems_version: !ruby/object:Gem::Requirement
93
94
  requirements:
94
95
  - - ">="
95
96
  - !ruby/object:Gem::Version
96
97
  version: '0'
97
98
  requirements: []
98
- rubyforge_project:
99
- rubygems_version: 2.7.3
99
+ rubygems_version: 3.0.3
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: Terminal cursor positioning, visibility and text manipulation.
@@ -106,3 +106,4 @@ test_files:
106
106
  - spec/unit/cursor_spec.rb
107
107
  - spec/unit/move_spec.rb
108
108
  - spec/unit/move_to_spec.rb
109
+ - spec/unit/scroll_spec.rb