diff options
author | André Luis Leal Cardoso Junior <andrehjr@gmail.com> | 2020-08-30 19:56:16 -0300 |
---|---|---|
committer | André Luis Leal Cardoso Junior <andrehjr@gmail.com> | 2020-10-05 21:57:25 -0300 |
commit | 60e84ee1d80919b0cc41268a878ffc9e78f903ac (patch) | |
tree | ccadb8dcb0edc067e07d1d7299066cd03d35037b /lib | |
parent | 22c35975ece86707a5c867a79862fd0816f69bbb (diff) | |
download | pry-60e84ee1d80919b0cc41268a878ffc9e78f903ac.tar.gz |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pry/helpers/text.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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. |