From 60e84ee1d80919b0cc41268a878ffc9e78f903ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luis=20Leal=20Cardoso=20Junior?= Date: Sun, 30 Aug 2020 19:56:16 -0300 Subject: Make #strip_color only remove colors. The previous implementation was removing more than that. When Pry.color = false, it was messing up the output of a few commands. --- lib/pry/helpers/text.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/pry') diff --git a/lib/pry/helpers/text.rb b/lib/pry/helpers/text.rb index b1fee03f..4ccedf83 100644 --- a/lib/pry/helpers/text.rb +++ b/lib/pry/helpers/text.rb @@ -44,7 +44,7 @@ class Pry # @param [String, #to_s] text # @return [String] _text_ stripped of any color codes. def strip_color(text) - text.to_s.gsub(/(\001)?\e\[.*?(\d)+m(\002)?/, '') + text.to_s.gsub(/(\001)?(\e\[(\d[;\d]?)*m)(\002)?/, '') end # Returns _text_ as bold text for use on a terminal. -- cgit v1.2.1