Conversation
|
@jgm what do you think about this interface? The motivation for this change is that ANSI escape codes in the terminal writer are currently included in length calculations, but should be treated as having width 0. Otherwise lines with markup come out shorter than they should. |
|
Wouldn't a better solution be to modify the width calculations in |
|
Making this part of doclayout seems a bit specialized. It would require doclayout to have knowledge about all (or the most important) escape sequences, which appears to be not entirely trivial. On the other hand, doing that would help to make centering possible: Positioning currently uses on |
|
I found this: https://hackage.haskell.org/package/vgrep-0.2.3.0/docs/src/Vgrep.Ansi.Parser.html#ansiFormatted |
|
The linked parser recognizes font-related sequences, which would be good enough for our use case. If I understand correctly, then the parser is just |
|
I think it's okay if we miss some obscure escape sequences, as long as all the things we identify as escape sequences actually are. So, no false positives. |
|
Some quick testing indicates that the last part should be |
|
Actually, doclayout uses a fancy state machine to compute widths, so we couldn't even reuse the parser, though it could help us to construct the state machine. Yes, go ahead and open an issue. |
No description provided.