From 1c52a98fb9e24bf254b43b0d3495664e18575336 Mon Sep 17 00:00:00 2001 From: naruse Date: Wed, 21 Feb 2018 06:00:51 +0000 Subject: merge revision(s) 61469: [Backport #14427] irb.rb: fix highlight * lib/irb.rb (IRB::Irb#eval_input): fix highlight for multiple lines exception messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/irb.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/irb.rb b/lib/irb.rb index ff793dcd64..d650e9c497 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -527,7 +527,9 @@ module IRB printf "... %d levels...\n", levels if levels > 0 end puts messages.reverse - print "#{attr[1]}#{exc.class} (#{attr[4]}#{exc}#{attr[0, 1]})#{attr[]}\n" + messages = exc.to_s.split(/\n/) + print "#{attr[1]}#{exc.class} (#{attr[4]}#{messages.shift}#{attr[0, 1]})#{attr[]}\n" + puts messages.map {|s| "#{attr[1]}#{s}#{attr[]}\n"} print "Maybe IRB bug!\n" if irb_bug end end -- cgit v1.2.3