Open Br31zh opened 3 years ago
Where are you printing text that supports formatting? Is this some panel? It would potentially be possible to support a specific format by changing the visual_len
and make_visual_len
, but I can't think of a way to support generic formatting... Maybe a regexp to strip out formatting (if a regexp is good enough to handle the formatting)?
I made a custom bash script that do a sort of scrolling, and I’m trying to replace it by your program (because of some limitations, like fullwidth characters).
But I got another problem, my custom script was able to manage formatting. In case of MPD, the artist name was bold, so the output look like this (for a 10-wide scrolling):
So the
<b></b>
weren’t counted in the total length, and removed when not necessary.I have no idea on how something similar can be implemented in you program (and generic, not only
<>
tags). It’s probably easy to ignore a substring in the count, but it’s harder to decide when adding or removing tags from the final string… but I think it can be a really cool enhancement.(The way I’m doing it in Bash is… terrible.)