Closed pjvleeuwen closed 4 years ago
Undecorate does not recognize nested colors/styles.
require 'pastel' require 'strscan' pastel = ::Pastel.new pastel.new.undecorate(pastel.bold('FIRST' + pastel.blue('SECOND') + 'THIRD'))[1] # {:foreground=>:blue, :text=>"SECOND"} pastel.new.undecorate(pastel.on_yellow('FIRST' + pastel.blue('SECOND') + 'THIRD'))[1] # {:foreground=>:blue, :text=>"SECOND"} pastel.new.undecorate(pastel.on_yellow('FIRST' + pastel.bold('SECOND') + 'THIRD'))[1] # {:style=>:bold, :text=>"SECOND"}
The nested part ('SECOND') does not not retain the wrapping color/style.
'SECOND'
Expected the undecorate to recognize the nested valid styles.
Ubuntu 18.04.3 LTS
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
FROM ruby:2.6.5
nice, thanks!
Released v0.8.0. Next, I'll update all the tty gems that rely on pastel and relax their version restrictions.
v0.8.0
tty
pastel
Describe the problem
Undecorate does not recognize nested colors/styles.
Steps to reproduce the problem
Actual behaviour
The nested part (
'SECOND'
) does not not retain the wrapping color/style.Expected behaviour
Expected the undecorate to recognize the nested valid styles.
Describe your environment
Ubuntu 18.04.3 LTS
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
(in docker,FROM ruby:2.6.5
)