diff options
author | aycabta <[email protected]> | 2021-12-21 15:50:59 +0900 |
---|---|---|
committer | git <[email protected]> | 2021-12-21 15:50:32 +0900 |
commit | 1855f901c801a4c21e0d2834da8ef914bf47f3d9 (patch) | |
tree | 91647108747e0603c3a9bd7768e0f8aa61334979 /lib/irb.rb | |
parent | 093aaeffbc71cd652393b66f2f6f9b865ab31efd (diff) |
[ruby/irb] Check colorize option correctly to clear char attr and don't use it for tests
https://github.com/ruby/irb/commit/de561cafeb
Diffstat (limited to 'lib/irb.rb')
-rw-r--r-- | lib/irb.rb | 9 |
1 files changed, 6 insertions, 3 deletions
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 |