ayonious / console-table-printer

🖥️ 🍭 Printing Pretty Tables on your console
https://console-table.netlify.app
MIT License
172 stars 22 forks source link

fix: use strip-ansi to normalize string width #440

Closed acrazing closed 1 year ago

acrazing commented 1 year ago

👀 Fix the string width with links.

Summary of what this is about

🚀 Changes

Fixed

🖼 Screenshots

Before After
image image
ayonious commented 1 year ago

@acrazing Thanks a lot for taking time to look into this. This has inspired me to make some more changes regarding the regex of ansii code. This PR is now not as necessary because of following reasons:

  1. I have recently added a better regex that will fix this Problem(or handle many more cases regarding ansi code styling). Please try it out and let me know if thats working. If you find more cases thats not working I will remove those as well.

  2. I dont want to add external packages unless its really necessary. I see from the regex that its scrapping all kind of ansi codes. For me as long as only decorative ansii codes are removed then this can be used in console-table-printer.

acrazing commented 1 year ago

Could your regex process terminal links?

For example: \x1B]8;;https://google.com/\x07google\x1B]8;;\x07. It prints google in terminal.