Skip to content

Commit 3733278

Browse files
committed
Fix warning
1 parent 3686cda commit 3733278

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# v2.0.1
2+
- Fix regexp warning
3+
14
# v2.0.0
25
- TTYString is now a module not a class.
36
- Address the issue where preserved styles and unknown codes would cause the cursor to be misaligned when moving, and potentially overwriting styles unexpectedly:

lib/tty_string/csi_code.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,14 @@ def re
2727
@re ||= /\e\[#{args_re}#{char}/
2828
end
2929

30-
def args_re
30+
def args_re # rubocop:disable Metrics/MethodLength
3131
case max_args
32-
when 0, 1 then /(?:[0-:<-?]*){0,#{max_args}}/
32+
# :nocov:
33+
when 0 then nil
34+
# :nocov:
35+
when 1 then /[0-:<-?]*/
3336
when -1 then %r{[0-?]*[ -/]*}
34-
else /(?:(?:[0-:<-?]*)?(?:;(?:[0-:<-?]*)?){0,#{max_args - 1}})?/
37+
else /(?:(?:[0-:<-?]*)(?:;(?:[0-:<-?]*)){0,#{max_args - 1}})?/
3538
end
3639
end
3740

lib/tty_string/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module TTYString
4-
VERSION = '2.0.0'
4+
VERSION = '2.0.1'
55
end

spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@
3131
config.expect_with :rspec do |c|
3232
c.syntax = :expect
3333
end
34+
config.warnings = true
3435
end

0 commit comments

Comments
 (0)