From b259640ae848b9900901a9996e8fbdc8d1fefcb1 Mon Sep 17 00:00:00 2001 From: dk034615 Date: Sun, 5 Jan 2025 16:08:32 -0700 Subject: [PATCH 1/3] =?UTF-8?q?bug:=F0=9F=90=9B=20default=20to=201=20for?= =?UTF-8?q?=20col=5Fcount=5Fcalculate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Changelog.md | 3 +++ lib/highline/list_renderer.rb | 4 ++-- lib/highline/version.rb | 2 +- test/test_highline.rb | 11 +++++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 7ac826bf..dbbb2608 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,9 @@ Below is a complete listing of changes for each revision of HighLine. +### 3.1.2 / 2025-01-05 +* PR #277 - Prevent ArgumentError for #col_count_calculate when items exceed 80 chars + ### 3.1.1 / 2024-08-18 * PR #276 - Update #say to always flush the output after a #puts (@blipper) * PR #274 / I #273 (@costa) diff --git a/lib/highline/list_renderer.rb b/lib/highline/list_renderer.rb index 5446ea52..cbd161e9 100644 --- a/lib/highline/list_renderer.rb +++ b/lib/highline/list_renderer.rb @@ -236,8 +236,8 @@ def row_join_str_size end def col_count_calculate - (line_size_limit + row_join_str_size) / - (items_max_length + row_join_str_size) + result = (line_size_limit + row_join_str_size) / (items_max_length + row_join_str_size) + result == 0 ? 1 : result end def col_count diff --git a/lib/highline/version.rb b/lib/highline/version.rb index 833ce3f9..10851f68 100644 --- a/lib/highline/version.rb +++ b/lib/highline/version.rb @@ -2,5 +2,5 @@ class HighLine # The version of the installed library. - VERSION = "3.1.1".freeze + VERSION = "3.1.2".freeze end diff --git a/test/test_highline.rb b/test/test_highline.rb index bd420c59..c9a4883f 100755 --- a/test/test_highline.rb +++ b/test/test_highline.rb @@ -1024,6 +1024,17 @@ def test_lists @output.truncate(@output.rewind) + colums_of_81 = ["1234567890" * (81 / 10) + "1"] + + @terminal.say("<%= list(#{colums_of_81.inspect}, :columns_down) %>") + assert_equal("1234567890123456789" \ + "01234567890123456789" \ + "01234567890123456789" \ + "0123456789012345678901\n", + @output.string) + + @output.truncate(@output.rewind) + @terminal.say("<%= list(#{digits.inspect}, :columns_across, 3) %>") assert_equal("Zero One Two \n" \ "Three Four Five \n" \ From 238a5eab09afd68c35be337e609d001c7289316e Mon Sep 17 00:00:00 2001 From: dk034615 Date: Sun, 5 Jan 2025 16:11:22 -0700 Subject: [PATCH 2/3] =?UTF-8?q?update:=20=F0=9F=93=9D=20changelog.mg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index dbbb2608..bdfc2a35 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,7 +3,7 @@ Below is a complete listing of changes for each revision of HighLine. ### 3.1.2 / 2025-01-05 -* PR #277 - Prevent ArgumentError for #col_count_calculate when items exceed 80 chars +* PR #278 - Prevent ArgumentError for #col_count_calculate when items exceed 80 chars ### 3.1.1 / 2024-08-18 * PR #276 - Update #say to always flush the output after a #puts (@blipper) From 035ecfc9b941abd0122b59824955152b1598c705 Mon Sep 17 00:00:00 2001 From: "Abinoam Praxedes Marques Jr." Date: Sun, 5 Jan 2025 22:25:48 -0300 Subject: [PATCH 3/3] Add authors to Changelog --- Changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index bdfc2a35..ec452ef0 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,7 +3,7 @@ Below is a complete listing of changes for each revision of HighLine. ### 3.1.2 / 2025-01-05 -* PR #278 - Prevent ArgumentError for #col_count_calculate when items exceed 80 chars +* PR #278 - Prevent ArgumentError for #col_count_calculate when items exceed 80 chars (@davidjkling, @justintsteele) ### 3.1.1 / 2024-08-18 * PR #276 - Update #say to always flush the output after a #puts (@blipper)