Open Telpenarmo opened 2 years ago
This almost always works well, but for example in Haskeline, all escape sequences are required to end with
\STX
byte for text to display properly (as explained in Haskeline wiki).
Could you possibly give an example that demonstrates how the missing \STX
byte breaks things?
I think the fix would be just to change
styleToRawText
fromT.pack . ANSI.setSGRCode . [stylesToSgrs]
toT.pack . (++ "\STX") . ANSI.setSGRCode . [stylesToSgrs]
. I would be happy to provide a tiny PR with this, if it's OK.
Have you considered changing setSGRCode
so it always appends the \STX
byte, or integrating functionality to generate the \STX
byte into ansi-terminal
in another way? I'm slightly hesitant about doing this change in prettyprinter-ansi-terminal
because so far the actual escape code generation has been left to ansi-terminal
.
Now rendering
AnsiStyle
-annotated docs generates escape sequence starting with\ESC
code before actual text, and similar sequence applying previous style at its end. This almost always works well, but for example in Haskeline, all escape sequences are required to end with\STX
byte for text to display properly (as explained in Haskeline wiki).I think the fix would be just to change
styleToRawText
fromT.pack . ANSI.setSGRCode . [stylesToSgrs]
toT.pack . (++ "\STX") . ANSI.setSGRCode . [stylesToSgrs]
. I would be happy to provide a tiny PR with this, if it's OK.To be honest, I did not found any other cases, but probably other readline-like libraries are also affected by this. On the other hand, I don't think there are any drawbacks of this change.