Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undecorate does not recognize nested color in style #24

Closed
pjvleeuwen opened this issue Mar 3, 2020 · 2 comments
Closed

undecorate does not recognize nested color in style #24

pjvleeuwen opened this issue Mar 3, 2020 · 2 comments

Comments

@pjvleeuwen
Copy link

pjvleeuwen commented Mar 3, 2020

Describe the problem

Undecorate does not recognize nested colors/styles.

Steps to reproduce the problem

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"}

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

  • OS version: Ubuntu 18.04.3 LTS
  • Ruby version: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux] (in docker, FROM ruby:2.6.5)
  • Pastel version: 0.7.3
@pjvleeuwen
Copy link
Author

nice, thanks!

@piotrmurach
Copy link
Owner

Released v0.8.0. Next, I'll update all the tty gems that rely on pastel and relax their version restrictions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants