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

sanitize removes brackets that it should not #21

Open
wenottingham opened this issue Jun 29, 2023 · 0 comments
Open

sanitize removes brackets that it should not #21

wenottingham opened this issue Jun 29, 2023 · 0 comments
Labels

Comments

@wenottingham
Copy link

wenottingham commented Jun 29, 2023

Describe the problem

When the ANSI sequence is directly wrapped in brackets the brackets are removed from the output.

Steps to reproduce the problem

require 'strings-ansi'

str1 = "[\e[1;34mINFO\e[m] Scanning for projects..."
str2 = "[ \e[1;34mINFO\e[m ] Scanning for projects..."
puts str1
puts str2
puts Strings::ANSI.sanitize(str1)
puts Strings::ANSI.sanitize(str2)

Actual behaviour

[INFO] Scanning for projects...
[ INFO ] Scanning for projects...
INFO Scanning for projects...
[ INFO ] Scanning for projects...

Expected behaviour

[INFO] Scanning for projects...
[ INFO ] Scanning for projects...
[INFO] Scanning for projects...
[ INFO ] Scanning for projects...

Describe your environment

  • OS version: Linux (Fedora 38)
  • Ruby version: 3.1.4
  • strings (0.2.1)
  • strings-ansi (0.2.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant