1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Merge pull request #717 from lloeki/fix_multiline_object_coloring

Pry <#.*> coloring falls apart when it has multiple lines
This commit is contained in:
Robert Gleeson 2012-09-26 08:04:57 -07:00
commit 24d9e486d7

View file

@ -32,7 +32,7 @@ class Pry
colorized = Helpers::BaseHelpers.colorize_code(stringified.gsub(/#</, "%<#{nonce}")) colorized = Helpers::BaseHelpers.colorize_code(stringified.gsub(/#</, "%<#{nonce}"))
# avoid colour-leak from CodeRay and any of the users' previous output # avoid colour-leak from CodeRay and any of the users' previous output
colorized = colorized.sub(/(\n*)$/, "\e[0m\\1") if Pry.color colorized = colorized.sub(/(\n*)\z/, "\e[0m\\1") if Pry.color
Helpers::BaseHelpers.stagger_output("=> #{colorized.gsub(/%<(.*?)#{nonce}/, '#<\1')}", output) Helpers::BaseHelpers.stagger_output("=> #{colorized.gsub(/%<(.*?)#{nonce}/, '#<\1')}", output)
end end