From 43381ba1733b36e1778a196796730a7a3101e883 Mon Sep 17 00:00:00 2001 From: supechicken Date: Sat, 15 Oct 2022 00:43:44 +0800 Subject: [PATCH] lib/downloader: Fix progress bar length on older CrOS terminals (#7482) * Fix progress bar on older CrOS terminals * Make rubocop happy * Use new color code functions * Make rubocop happy * Align variables * Fix typo * Remove extra space --- lib/progress_bar.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/progress_bar.rb b/lib/progress_bar.rb index 021fcb4ec..46a251206 100644 --- a/lib/progress_bar.rb +++ b/lib/progress_bar.rb @@ -13,8 +13,8 @@ class ProgressBar # color scheme of progress bar, can be changed # see color.rb for more available colors - @bar_front_color = :lightcyan - @bar_bg_color = :gray + @bar_front_color = %i[lightcyan no_bold] + @bar_bg_color = %i[gray no_bold] # all info blocks with space taken @info_before_bar = { downloaded_size_in_str: 20 } @@ -94,8 +94,8 @@ class ProgressBar end # print progress bar with color code - print ( @bar_char * completed_length).send(@bar_front_color), - (@bar_char * uncompleted_length).send(@bar_bg_color) + print (@bar_char * completed_length).send(*@bar_front_color), + (@bar_char * uncompleted_length).send(*@bar_bg_color) @info_after_bar.each_pair do |varName, width| printf ' %*.*s', width, width, instance_variable_get("@#{varName}")