Text reflow woes (or: I want bullets back!)y
Brian Evans
b__m__e at mailfence.com
Sat Jan 18 21:34:27 GMT 2020
Aaron Janse writes:
> Hmmm. It does seem, though, that *allowing* ANSI colors would require
> non-terminal clients to strip ANSI colors, which would be a PITA,
> expecially considering that ANSI is a hot mess (I built an ANSI parser
> a while ago [1])
Currently Bombadillo has a few different modes. The normal mode removes
ansi escape codes. As I am parsing a document if I read an `\033` character I
just toggle an escape code boolean and then consume until I read a A-Za-z
character (and consume that char as well). It works very quickly and handles
removing them quite well. I do the same thing for the color mode for any
escape codes that do not end in `m`. That said, it may not work as well for
people not parsing by writing characters into a buffer char by char.
I would also argue that it would _not_ require clients to strip them. There are
a few options:
1. Decide, rightly in my opinion, that if a content creator uses escape codes
they are taking the chance that the codes themselves will be displayed to
the eventual viewer depending on the client.
2. Do a simple find and replace on the whole document for '\033' and replace
it with "ESC". While this will still leave the codes displaying to the viewer
they will not actually render, thus you do not need to worry about line
movement, screen clears, etc.
--
Sent with https://mailfence.com
Secure and private email
More information about the Gemini
mailing list