haskell-prettyprinter / haskell-prettyprinter/prettyprinter

Control sequences should end with \STX code

Open
#225 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
309
Forks
43
Avg merge
21h 25m
Merged PRs (30d)
1

Description

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](https://github.com/judah/haskeline/wiki/ControlSequencesInPrompt)).

I think the fix would be just to change `styleToRawText` from `T.pack . ANSI.setSGRCode . [stylesToSgrs]` to `T.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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.