tty-cursor 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +4 -0
- data/lib/tty/cursor/version.rb +1 -1
- metadata +17 -26
- data/Rakefile +0 -8
- data/spec/spec_helper.rb +0 -45
- data/spec/unit/clear_lines_spec.rb +0 -57
- data/spec/unit/cursor_spec.rb +0 -103
- data/spec/unit/move_spec.rb +0 -29
- data/spec/unit/move_to_spec.rb +0 -13
- data/spec/unit/scroll_spec.rb +0 -13
- data/tasks/console.rake +0 -11
- data/tasks/coverage.rake +0 -11
- data/tasks/spec.rake +0 -29
- data/tty-cursor.gemspec +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1f0ad7d0b4e645fe5dbc713b7926857555b92635e592b51090a0cdab19cfe11
|
4
|
+
data.tar.gz: d125170df7a8f729e4c342c7892d32f58c20fb25cd9f9966c04bd9ab11cf863b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0acf7bf1d0e17145263c9311bb875649a04ac876bc4013e1b399b12e2b04302160a0321c87e1fb0a811d851f8e8fc05f11bc757aa9f588f77b39b49f6fc7c7d
|
7
|
+
data.tar.gz: 57c61fe14d394bf2ee5c8f26001338a4799d9c5e531e410786f6205603ad06bd56245cb1c8dc10408eeab844e2ceaedbdf098d5cfcc308289d406767ad1b8ba0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## [v0.7.1] - 2020-01-25
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
* Change gemspec to include metadata and remove test files
|
7
|
+
|
3
8
|
## [v0.7.0] - 2019-05-27
|
4
9
|
|
5
10
|
### Added
|
@@ -59,6 +64,7 @@
|
|
59
64
|
|
60
65
|
* Initial implementation and release
|
61
66
|
|
67
|
+
[v0.7.0]: https://github.com/piotrmurach/tty-cursor/compare/v0.7.0...v0.7.1
|
62
68
|
[v0.7.0]: https://github.com/piotrmurach/tty-cursor/compare/v0.6.1...v0.7.0
|
63
69
|
[v0.6.1]: https://github.com/piotrmurach/tty-cursor/compare/v0.6.0...v0.6.1
|
64
70
|
[v0.6.0]: https://github.com/piotrmurach/tty-cursor/compare/v0.5.0...v0.6.0
|
data/README.md
CHANGED
@@ -255,6 +255,10 @@ Scroll display up one line.
|
|
255
255
|
|
256
256
|
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
257
257
|
|
258
|
+
## Code of Conduct
|
259
|
+
|
260
|
+
Everyone interacting in the Strings::Inflection project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/piotrmurach/tty-cursor/blob/master/CODE_OF_CONDUCT.md).
|
261
|
+
|
258
262
|
## Copyright
|
259
263
|
|
260
264
|
Copyright (c) 2015 Piotr Murach. See LICENSE for further details.
|
data/lib/tty/cursor/version.rb
CHANGED
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.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,32 +55,29 @@ dependencies:
|
|
55
55
|
description: The purpose of this library is to help move the terminal cursor around
|
56
56
|
and manipulate text by using intuitive method calls.
|
57
57
|
email:
|
58
|
-
-
|
58
|
+
- piotr@piotrmurach.com
|
59
59
|
executables: []
|
60
60
|
extensions: []
|
61
|
-
extra_rdoc_files:
|
61
|
+
extra_rdoc_files:
|
62
|
+
- README.md
|
63
|
+
- CHANGELOG.md
|
62
64
|
files:
|
63
65
|
- CHANGELOG.md
|
64
66
|
- LICENSE.txt
|
65
67
|
- README.md
|
66
|
-
- Rakefile
|
67
68
|
- lib/tty-cursor.rb
|
68
69
|
- lib/tty/cursor.rb
|
69
70
|
- lib/tty/cursor/version.rb
|
70
|
-
|
71
|
-
- spec/unit/clear_lines_spec.rb
|
72
|
-
- spec/unit/cursor_spec.rb
|
73
|
-
- spec/unit/move_spec.rb
|
74
|
-
- spec/unit/move_to_spec.rb
|
75
|
-
- spec/unit/scroll_spec.rb
|
76
|
-
- tasks/console.rake
|
77
|
-
- tasks/coverage.rake
|
78
|
-
- tasks/spec.rake
|
79
|
-
- tty-cursor.gemspec
|
80
|
-
homepage: http://piotrmurach.github.io/tty/
|
71
|
+
homepage: https://ttytoolkit.org
|
81
72
|
licenses:
|
82
73
|
- MIT
|
83
|
-
metadata:
|
74
|
+
metadata:
|
75
|
+
allowed_push_host: https://rubygems.org
|
76
|
+
bug_tracker_uri: https://github.com/piotrmurach/tty-cursor/issues
|
77
|
+
changelog_uri: https://github.com/piotrmurach/tty-cursor/blob/master/CHANGELOG.md
|
78
|
+
documentation_uri: https://www.rubydoc.info/gems/tty-cursor
|
79
|
+
homepage_uri: https://ttytoolkit.org
|
80
|
+
source_code_uri: https://github.com/piotrmurach/tty-cursor
|
84
81
|
post_install_message:
|
85
82
|
rdoc_options: []
|
86
83
|
require_paths:
|
@@ -96,14 +93,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
93
|
- !ruby/object:Gem::Version
|
97
94
|
version: '0'
|
98
95
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
96
|
+
rubygems_version: 3.1.2
|
100
97
|
signing_key:
|
101
98
|
specification_version: 4
|
102
99
|
summary: Terminal cursor positioning, visibility and text manipulation.
|
103
|
-
test_files:
|
104
|
-
- spec/spec_helper.rb
|
105
|
-
- spec/unit/clear_lines_spec.rb
|
106
|
-
- spec/unit/cursor_spec.rb
|
107
|
-
- spec/unit/move_spec.rb
|
108
|
-
- spec/unit/move_to_spec.rb
|
109
|
-
- spec/unit/scroll_spec.rb
|
100
|
+
test_files: []
|
data/Rakefile
DELETED
data/spec/spec_helper.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
if ENV['COVERAGE'] || ENV['TRAVIS']
|
4
|
-
require 'simplecov'
|
5
|
-
require 'coveralls'
|
6
|
-
|
7
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
8
|
-
SimpleCov::Formatter::HTMLFormatter,
|
9
|
-
Coveralls::SimpleCov::Formatter
|
10
|
-
])
|
11
|
-
|
12
|
-
SimpleCov.start do
|
13
|
-
command_name 'spec'
|
14
|
-
add_filter 'spec'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
require 'tty-cursor'
|
19
|
-
|
20
|
-
RSpec.configure do |config|
|
21
|
-
config.expect_with :rspec do |expectations|
|
22
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
23
|
-
end
|
24
|
-
|
25
|
-
config.mock_with :rspec do |mocks|
|
26
|
-
mocks.verify_partial_doubles = true
|
27
|
-
end
|
28
|
-
|
29
|
-
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
30
|
-
config.disable_monkey_patching!
|
31
|
-
|
32
|
-
# This setting enables warnings. It's recommended, but in some cases may
|
33
|
-
# be too noisy due to issues in dependencies.
|
34
|
-
config.warnings = true
|
35
|
-
|
36
|
-
if config.files_to_run.one?
|
37
|
-
config.default_formatter = 'doc'
|
38
|
-
end
|
39
|
-
|
40
|
-
config.profile_examples = 2
|
41
|
-
|
42
|
-
config.order = :random
|
43
|
-
|
44
|
-
Kernel.srand config.seed
|
45
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe TTY::Cursor, '#clear_lines' do
|
4
|
-
subject(:cursor) { described_class }
|
5
|
-
|
6
|
-
it "clears character" do
|
7
|
-
expect(cursor.clear_char).to eq("\e[X")
|
8
|
-
end
|
9
|
-
|
10
|
-
it "clears few characters" do
|
11
|
-
expect(cursor.clear_char(5)).to eq("\e[5X")
|
12
|
-
end
|
13
|
-
|
14
|
-
it "clears line" do
|
15
|
-
expect(cursor.clear_line).to eq("\e[2K\e[1G")
|
16
|
-
end
|
17
|
-
|
18
|
-
it "clears the line before the cursor" do
|
19
|
-
expect(cursor.clear_line_before).to eq("\e[1K")
|
20
|
-
end
|
21
|
-
|
22
|
-
it "clears the line after the cursor" do
|
23
|
-
expect(cursor.clear_line_after).to eq("\e[0K")
|
24
|
-
end
|
25
|
-
|
26
|
-
it "clears 5 lines up" do
|
27
|
-
expect(cursor.clear_lines(5)).to eq([
|
28
|
-
"\e[2K\e[1G\e[1A",
|
29
|
-
"\e[2K\e[1G\e[1A",
|
30
|
-
"\e[2K\e[1G\e[1A",
|
31
|
-
"\e[2K\e[1G\e[1A",
|
32
|
-
"\e[2K\e[1G"
|
33
|
-
].join)
|
34
|
-
end
|
35
|
-
|
36
|
-
it "clears 5 lines down" do
|
37
|
-
expect(cursor.clear_lines(5, :down)).to eq([
|
38
|
-
"\e[2K\e[1G\e[1B",
|
39
|
-
"\e[2K\e[1G\e[1B",
|
40
|
-
"\e[2K\e[1G\e[1B",
|
41
|
-
"\e[2K\e[1G\e[1B",
|
42
|
-
"\e[2K\e[1G"
|
43
|
-
].join)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "clears screen down" do
|
47
|
-
expect(cursor.clear_screen_down).to eq("\e[J")
|
48
|
-
end
|
49
|
-
|
50
|
-
it "clears screen up" do
|
51
|
-
expect(cursor.clear_screen_up).to eq("\e[1J")
|
52
|
-
end
|
53
|
-
|
54
|
-
it "clears entire screen" do
|
55
|
-
expect(cursor.clear_screen).to eq("\e[2J")
|
56
|
-
end
|
57
|
-
end
|
data/spec/unit/cursor_spec.rb
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe TTY::Cursor do
|
4
|
-
subject(:cursor) { described_class }
|
5
|
-
|
6
|
-
it "shows cursor" do
|
7
|
-
expect(cursor.show).to eq("\e[?25h")
|
8
|
-
end
|
9
|
-
|
10
|
-
it "hides cursor" do
|
11
|
-
expect(cursor.hide).to eq("\e[?25l")
|
12
|
-
end
|
13
|
-
|
14
|
-
it "saves cursor position" do
|
15
|
-
allow(Gem).to receive(:win_platform?).and_return(false)
|
16
|
-
|
17
|
-
expect(cursor.save).to eq("\e7")
|
18
|
-
end
|
19
|
-
|
20
|
-
it "saves cursor position on Windows" do
|
21
|
-
allow(Gem).to receive(:win_platform?).and_return(true)
|
22
|
-
|
23
|
-
expect(cursor.save).to eq("\e[s")
|
24
|
-
end
|
25
|
-
|
26
|
-
it "restores cursor position" do
|
27
|
-
allow(Gem).to receive(:win_platform?).and_return(false)
|
28
|
-
|
29
|
-
expect(cursor.restore).to eq("\e8")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "restores cursor position on Windows" do
|
33
|
-
allow(Gem).to receive(:win_platform?).and_return(true)
|
34
|
-
|
35
|
-
expect(cursor.restore).to eq("\e[u")
|
36
|
-
end
|
37
|
-
|
38
|
-
it "gets current cursor position" do
|
39
|
-
expect(cursor.current).to eq("\e[6n")
|
40
|
-
end
|
41
|
-
|
42
|
-
it "moves cursor up default by 1 line" do
|
43
|
-
expect(cursor.up).to eq("\e[1A")
|
44
|
-
end
|
45
|
-
|
46
|
-
it "moves cursor up by 5 lines" do
|
47
|
-
expect(cursor.up(5)).to eq("\e[5A")
|
48
|
-
end
|
49
|
-
|
50
|
-
it "moves cursor down default by 1 line" do
|
51
|
-
expect(cursor.down).to eq("\e[1B")
|
52
|
-
end
|
53
|
-
|
54
|
-
it "moves cursor down by 5 lines" do
|
55
|
-
expect(cursor.down(5)).to eq("\e[5B")
|
56
|
-
end
|
57
|
-
|
58
|
-
it "moves cursorleft by 1 line default" do
|
59
|
-
expect(cursor.backward).to eq("\e[1D")
|
60
|
-
end
|
61
|
-
|
62
|
-
it "moves cursor left by 5" do
|
63
|
-
expect(cursor.backward(5)).to eq("\e[5D")
|
64
|
-
end
|
65
|
-
|
66
|
-
it "moves cursor right by 1 line default" do
|
67
|
-
expect(cursor.forward).to eq("\e[1C")
|
68
|
-
end
|
69
|
-
|
70
|
-
it "moves cursor right by 5 lines" do
|
71
|
-
expect(cursor.forward(5)).to eq("\e[5C")
|
72
|
-
end
|
73
|
-
|
74
|
-
it "moves cursor horizontal to start" do
|
75
|
-
expect(cursor.column).to eq("\e[1G")
|
76
|
-
end
|
77
|
-
|
78
|
-
it "moves cursor horizontally to 66th position" do
|
79
|
-
expect(cursor.column(66)).to eq("\e[66G")
|
80
|
-
end
|
81
|
-
|
82
|
-
it "moves cursor vertically to start" do
|
83
|
-
expect(cursor.row).to eq("\e[1d")
|
84
|
-
end
|
85
|
-
|
86
|
-
it "moves cursor vertically to 50th row" do
|
87
|
-
expect(cursor.row(50)).to eq("\e[50d")
|
88
|
-
end
|
89
|
-
|
90
|
-
it "moves cursor to next line" do
|
91
|
-
expect(cursor.next_line).to eq("\e[E\e[1G")
|
92
|
-
end
|
93
|
-
|
94
|
-
it "moves cursor to previous line" do
|
95
|
-
expect(cursor.prev_line).to eq("\e[A\e[1G")
|
96
|
-
end
|
97
|
-
|
98
|
-
it "hides cursor for the duration of block call" do
|
99
|
-
stream = StringIO.new
|
100
|
-
cursor.invisible(stream) { }
|
101
|
-
expect(stream.string).to eq("\e[?25l\e[?25h")
|
102
|
-
end
|
103
|
-
end
|
data/spec/unit/move_spec.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe TTY::Cursor, '#move' do
|
4
|
-
subject(:cursor) { described_class }
|
5
|
-
|
6
|
-
it "doesn't move for point (0, 0)" do
|
7
|
-
expect(cursor.move(0, 0)).to eq('')
|
8
|
-
end
|
9
|
-
|
10
|
-
it "moves only to the right" do
|
11
|
-
expect(cursor.move(2, 0)).to eq("\e[2C")
|
12
|
-
end
|
13
|
-
|
14
|
-
it "moves right and up" do
|
15
|
-
expect(cursor.move(2, 3)).to eq("\e[2C\e[3A")
|
16
|
-
end
|
17
|
-
|
18
|
-
it "moves right and down" do
|
19
|
-
expect(cursor.move(2, -3)).to eq("\e[2C\e[3B")
|
20
|
-
end
|
21
|
-
|
22
|
-
it "moves left and up" do
|
23
|
-
expect(cursor.move(-2, 3)).to eq("\e[2D\e[3A")
|
24
|
-
end
|
25
|
-
|
26
|
-
it "moves left and down" do
|
27
|
-
expect(cursor.move(-2, -3)).to eq("\e[2D\e[3B")
|
28
|
-
end
|
29
|
-
end
|
data/spec/unit/move_to_spec.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe TTY::Cursor, '#move_to' do
|
4
|
-
subject(:cursor) { described_class }
|
5
|
-
|
6
|
-
it "moves to home" do
|
7
|
-
expect(cursor.move_to). to eq("\e[H")
|
8
|
-
end
|
9
|
-
|
10
|
-
it "moves to row and column" do
|
11
|
-
expect(cursor.move_to(2, 3)).to eq("\e[4;3H")
|
12
|
-
end
|
13
|
-
end
|
data/spec/unit/scroll_spec.rb
DELETED
@@ -1,13 +0,0 @@
|
|
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
|
data/tasks/console.rake
DELETED
data/tasks/coverage.rake
DELETED
data/tasks/spec.rake
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'rspec/core/rake_task'
|
5
|
-
|
6
|
-
desc 'Run all specs'
|
7
|
-
RSpec::Core::RakeTask.new(:spec) do |task|
|
8
|
-
task.pattern = 'spec/{unit,integration}{,/*/**}/*_spec.rb'
|
9
|
-
end
|
10
|
-
|
11
|
-
namespace :spec do
|
12
|
-
desc 'Run unit specs'
|
13
|
-
RSpec::Core::RakeTask.new(:unit) do |task|
|
14
|
-
task.pattern = 'spec/unit{,/*/**}/*_spec.rb'
|
15
|
-
end
|
16
|
-
|
17
|
-
desc 'Run integration specs'
|
18
|
-
RSpec::Core::RakeTask.new(:integration) do |task|
|
19
|
-
task.pattern = 'spec/integration{,/*/**}/*_spec.rb'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
rescue LoadError
|
24
|
-
%w[spec spec:unit spec:integration].each do |name|
|
25
|
-
task name do
|
26
|
-
$stderr.puts "In order to run #{name}, do `gem install rspec`"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/tty-cursor.gemspec
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
lib = File.expand_path('../lib', __FILE__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require 'tty/cursor/version'
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = 'tty-cursor'
|
7
|
-
spec.version = TTY::Cursor::VERSION
|
8
|
-
spec.authors = ["Piotr Murach"]
|
9
|
-
spec.email = ["me@piotrmurach.com"]
|
10
|
-
spec.summary = %q{Terminal cursor positioning, visibility and text manipulation.}
|
11
|
-
spec.description = %q{The purpose of this library is to help move the terminal cursor around and manipulate text by using intuitive method calls.}
|
12
|
-
spec.homepage = 'http://piotrmurach.github.io/tty/'
|
13
|
-
spec.license = "MIT"
|
14
|
-
|
15
|
-
spec.files = Dir['{lib,spec}/**/*.rb']
|
16
|
-
spec.files += Dir['tasks/*', 'tty-cursor.gemspec']
|
17
|
-
spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile']
|
18
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
-
spec.require_paths = ["lib"]
|
21
|
-
|
22
|
-
spec.required_ruby_version = '>= 2.0.0'
|
23
|
-
|
24
|
-
spec.add_development_dependency 'bundler', '>= 1.6'
|
25
|
-
spec.add_development_dependency 'rspec', '~> 3.1'
|
26
|
-
spec.add_development_dependency 'rake'
|
27
|
-
end
|