Open user4815162342 opened 6 years ago
tried using something like 'ansi-escape-sequences' ? - just concat along the setContent() string .. some terminals don't
@cancerberoSgx: Looks like ansi-escape-sequences is using the same escape code that I described above, so it's not going to do anything diffferent.
It's been a long time since I looked into this, but I remember digging into the code to see where the problem was. If I recall correctly, Blessed erases any escape codes it doesn't know anything about, somewhere between setContent and rendering. So any escape codes like the above that I put into setContent would not do anything.
In more detail: Before rendering a widget, Blessed translates the content into two variables. One is a string containing only the displayable text. The other is an array of style data that lines up with that string. In the process of converting the escape codes from the content into the style data, Blessed translates only the escape codes that it understands. Any other escape codes are dropped.
did you tried just console.log the string ? according with ansi.escape-sequences italic is not supported by 100% of terminals. I?m on MAC now and it doesn't seems tobe supported
The command I mentioned in my original post produces italic output in my terminal.
@user4815162342 Did you ever find a solution to using unsupported escapes in a widget? I'd like to know where blessed is 'clearing' unknown escape codes in the hope of modifying blessed its self if a more trivial passthrough method can't be found
@zach-is-my-name It's been years since I looked at this, and no I never found a solution. The project I was using it on also fell by the wayside, so I don't use this library anymore.
I do recall that it just took a bit of source code delving to find out where the data was getting modified. There was no way to pass the data through.
If you look through the source code for the rendering function (I think it's called "render", and I believe it's on the widget or one of it's prototypes), and follow the data, you'll eventually find the conversion I mentioned a few comments above. I can give you no more information, and even if I could, you'll understand what's going on better if you do it yourself.
Many terminals support italic text. It would be nice if blessed supported it as a possible style tag as well.
The following will show as italic if your terminal (linux) supports italic.
Blessed does not have an 'italic' tag. When I set the escape codes directly in the content of a widget, the text does not show up as italic, despite the above command line working in that same terminal.