highline 3.1.1 → 3.1.2

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: a711e47ab4e364e5f470dfd8bb716028fce1eaf32134470b4f355d9323a5eb60
4
- data.tar.gz: 931ccc44047bba2fa2c52521ce8eed9183cbe27fffc1a652ef79c7ed9f406443
3
+ metadata.gz: b9d2b093cb533443369ed3d5c31f6c09f1d5fdfd4d5b9f89a1e48d8da20a377a
4
+ data.tar.gz: 150008ffff933909afcc40ebdee9bba538dc1170331a4a58cd5ebff5fc582738
5
5
  SHA512:
6
- metadata.gz: 14ccf0f79acbebd05e46b8ec4c598356bf6d64eeb4808b471e8df61f5fa056656a27c2d029a13fb3a82f3f04c979f75a7578ceed3e5848b1165a237648816e60
7
- data.tar.gz: 2bd934d2e17bf4f4e4fe180317962c1eeddebdae80ac423d54ba689579ee2ed25ea81cbf2a106bcab705297d6866effb8faece92c6d76ec268cfa2a4b2bec367
6
+ metadata.gz: 016dc7d742577f9cb8fbca44a07e14a9911b314afb9ad4974456ae29fb379705a4161e48eb19c73fb2a7afe6ae602272360141b09cc17ad33346eb00a03f34e8
7
+ data.tar.gz: 41d933367b093d1296535eedcf8ffc147c561dd51f07ef81d20d3c044877c93d1c3eb0c96a783e1c0f4cfd444ceb1bbbda26c21509519515571cab87ac3744ba
@@ -10,6 +10,7 @@ jobs:
10
10
  os: [ubuntu-latest]
11
11
  ruby-version:
12
12
  - head
13
+ - '3.4'
13
14
  - '3.3'
14
15
  - '3.2'
15
16
  - '3.1'
@@ -23,7 +24,7 @@ jobs:
23
24
  - os: windows-latest
24
25
  ruby-version: head
25
26
  - os: windows-latest
26
- ruby-version: '3.3'
27
+ ruby-version: '3.4'
27
28
  - os: windows-latest
28
29
  ruby-version: mingw
29
30
  - os: windows-latest
@@ -33,7 +34,7 @@ jobs:
33
34
  - os: macos-latest
34
35
  ruby-version: 'head'
35
36
  - os: macos-latest
36
- ruby-version: '3.3'
37
+ ruby-version: '3.4'
37
38
  runs-on: ${{ matrix.os }}
38
39
  steps:
39
40
  - uses: actions/checkout@v4
data/.rubocop.yml CHANGED
@@ -4,7 +4,7 @@
4
4
  # https://github.com/bbatsov/rubocop/tree/master/config
5
5
 
6
6
  AllCops:
7
- TargetRubyVersion: 3.3
7
+ TargetRubyVersion: 3.4
8
8
  NewCops: enable
9
9
 
10
10
  # General
data/Changelog.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Below is a complete listing of changes for each revision of HighLine.
4
4
 
5
+ ### 3.1.2 / 2025-01-05
6
+ * PR #279 - Upgrades and adjustments for Ruby 3.4 release (@abinoam)
7
+ * PR #278 - Prevent ArgumentError for #col_count_calculate when items exceed 80 chars (@davidjkling, @justintsteele)
8
+
5
9
  ### 3.1.1 / 2024-08-18
6
10
  * PR #276 - Update #say to always flush the output after a #puts (@blipper)
7
11
  * PR #274 / I #273 (@costa)
data/Gemfile CHANGED
@@ -17,4 +17,5 @@ group :code_quality do
17
17
  # gem "pronto-poper", require: false, platform: :ruby
18
18
  gem "pronto-reek", require: false, platform: :ruby
19
19
  gem "pronto-rubocop", require: false, platform: :ruby
20
+ gem "base64", require: false
20
21
  end
@@ -236,8 +236,8 @@ class HighLine
236
236
  end
237
237
 
238
238
  def col_count_calculate
239
- (line_size_limit + row_join_str_size) /
240
- (items_max_length + row_join_str_size)
239
+ result = (line_size_limit + row_join_str_size) / (items_max_length + row_join_str_size)
240
+ result == 0 ? 1 : result
241
241
  end
242
242
 
243
243
  def col_count
data/lib/highline/menu.rb CHANGED
@@ -374,12 +374,14 @@ class HighLine
374
374
  end
375
375
 
376
376
  def map_items_by_index
377
- if [:letter, :capital_letter].include?(@index)
378
- # @ and ` are the previous ASCII characters to A and a respectively
379
- prev_char = (@index == :capital_letter ? '@' : '`')
380
- all_items.map { prev_char.succ!.dup }
377
+ size = all_items.size
378
+ case @index
379
+ when :letter
380
+ ("a".."z").first(size)
381
+ when :capital_letter
382
+ ("A".."Z").first(size)
381
383
  else
382
- (1..all_items.size).map(&:to_s)
384
+ (1..size).map(&:to_s)
383
385
  end
384
386
  end
385
387
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  class HighLine
4
4
  # The version of the installed library.
5
- VERSION = "3.1.1".freeze
5
+ VERSION = "3.1.2".freeze
6
6
  end
data/lib/highline.rb CHANGED
@@ -555,21 +555,26 @@ class HighLine
555
555
  terminal.raw_no_echo_mode_exec do
556
556
  loop do
557
557
  character = terminal.get_character
558
- raise Interrupt if character == "\u0003"
559
- break unless character
560
- break if ["\n", "\r"].include? character
561
-
562
- # honor backspace and delete
563
- if character == "\b" || character == "\u007F"
564
- chopped = line.chop!
565
- output_erase_char if chopped && question.echo
566
- elsif character == "\cU"
558
+
559
+ case character
560
+ when "\u0003" # Ctrl+C (Interrupt)
561
+ raise Interrupt
562
+ when nil # No character received
563
+ break
564
+ when "\n", "\r" # Newline or carriage return
565
+ break
566
+ when "\b", "\u007F" # Backspace and delete
567
+ unless line.empty?
568
+ line = line.chop
569
+ output_erase_char if question.echo
570
+ end
571
+ when "\cU" # Clear line
567
572
  line.size.times { output_erase_char } if question.echo
568
573
  line = ""
569
- elsif character == "\e"
574
+ when "\e" # Escape key
570
575
  ignore_arrow_key
571
- else
572
- line << character
576
+ else # Any other character
577
+ line += character
573
578
  say_last_char_or_echo_char(line, question)
574
579
  end
575
580
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: highline
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Edward Gray II
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-28 00:00:00.000000000 Z
10
+ date: 2025-01-06 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -159,7 +158,6 @@ licenses:
159
158
  - Ruby
160
159
  metadata:
161
160
  changelog_uri: https://github.com/JEG2/highline/blob/master/Changelog.md
162
- post_install_message:
163
161
  rdoc_options: []
164
162
  require_paths:
165
163
  - lib
@@ -174,8 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
172
  - !ruby/object:Gem::Version
175
173
  version: '0'
176
174
  requirements: []
177
- rubygems_version: 3.5.11
178
- signing_key:
175
+ rubygems_version: 3.6.2
179
176
  specification_version: 4
180
177
  summary: HighLine is a high-level command-line IO library.
181
178
  test_files: []