From 1855f901c801a4c21e0d2834da8ef914bf47f3d9 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 21 Dec 2021 15:50:59 +0900 Subject: [ruby/irb] Check colorize option correctly to clear char attr and don't use it for tests https://github.com/ruby/irb/commit/de561cafeb --- lib/irb.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/irb.rb b/lib/irb.rb index f48a0a2d4d..6887d5596e 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -824,17 +824,20 @@ module IRB diff_size = output_width - Reline::Unicode.calculate_width(first_line, true) if diff_size.positive? and output_width > winwidth lines, _ = Reline::Unicode.split_by_width(first_line, winwidth - diff_size - 3) - str = "%s...\e[0m" % lines.first + str = "%s..." % lines.first + str += "\e[0m" if @context.use_colorize multiline_p = false else - str = str.gsub(/(\A.*?\n).*/m, "\\1...\e[0m") + str = str.gsub(/(\A.*?\n).*/m, "\\1...") + str += "\e[0m" if @context.use_colorize end else output_width = Reline::Unicode.calculate_width(@context.return_format % str, true) diff_size = output_width - Reline::Unicode.calculate_width(str, true) if diff_size.positive? and output_width > winwidth lines, _ = Reline::Unicode.split_by_width(str, winwidth - diff_size - 3) - str = "%s...\e[0m" % lines.first + str = "%s..." % lines.first + str += "\e[0m" if @context.use_colorize end end end -- cgit v1.2.3