summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authortompng <tomoyapenguin@gmail.com>2022-08-02 04:10:45 +0900
committergit <svn-admin@ruby-lang.org>2022-08-04 08:37:03 +0900
commitb54f26b7048fc8dd103e7da5cf8f8dd73feb10d0 (patch)
tree4b671f6dc20efbb097a52bfb5090dd8ff53f4e8b /lib
parent4406cb1bf10e34757d9877b3b12d4b0c294c22fb (diff)
[ruby/irb] shortcut colorize_code to speedup pretty_print
https://github.com/ruby/irb/commit/8a074a6904
Diffstat (limited to 'lib')
-rw-r--r--lib/irb/color_printer.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/irb/color_printer.rb b/lib/irb/color_printer.rb
index 78f0b51520..1127bcecb4 100644
--- a/lib/irb/color_printer.rb
+++ b/lib/irb/color_printer.rb
@@ -37,6 +37,9 @@ module IRB
width ||= str.length
case str
+ when ''
+ when ',', '=>', '[', ']', '{', '}', '..', '...', /\A@\w+\z/
+ super(str, width)
when /\A#</, '=', '>'
super(Color.colorize(str, [:GREEN]), width)
else