You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for using tty-box and tty-link. Also thanks for reporting this issue.
The tty-link emits ANSI codes which are incorrectly taken into account when calculating total width, hence the 'abnormal' box size. The same would happen if you tried using a link inside the box content.
Under the covers the tty-box relies on strings and in particular strings-ansi gem to handle a box content formatting. To handle links width calculation, the strings-ansi needs to know how to remove link codes. I merged PR recently which adds support for this.
I still need to finish working on the strings-ansi gem. Unfortunately releasing it won't fix the issue as I'd need to address it in the tty-box gem next. Currently, I'm refactoring internals of tty-box to turn it into a class. The API won't change. However, it will be more flexible so you can retrieve information about box's content size etc.
box=TTY::Box.new("<content>")box.content_width# width without any ANSI codes# etc...
This is all to say that this won't be a 'quick fix. The strings-ansi powers a few tty components so I need to tread carefully. This comes under 'do my best' timeline.
Great gem! I'm just having some small issues with TTY::Link:
The text was updated successfully, but these errors were encountered: