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

helpers/text: when strip colours, also strip special characters

Fixes build failures introduced in

  a293f1f3aa
This commit is contained in:
Kyrylo Silin 2015-03-06 08:42:12 +02:00
parent 05a3ba7426
commit c220c40892

View file

@ -31,7 +31,7 @@ class Pry
# @param [String, #to_s] text
# @return [String] _text_ stripped of any color codes.
def strip_color(text)
text.to_s.gsub(/\e\[.*?(\d)+m/ , '')
text.to_s.gsub(/(\001)?\e\[.*?(\d)+m(\002)?/ , '')
end
# Returns _text_ as bold text for use on a terminal.