💾 Archived View for rawtext.club › ~sloum › geminilist › 000380.gmi captured on 2020-09-24 at 02:36:46. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
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-zcharacter (and consume that char as well). It works very quickly and handlesremoving them quite well. I do the same thing for the color mode for anyescape codes that do not end in `m`. That said, it may not work as well forpeople 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 area 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.comSecure and private email