~technomancy/fennel

1

Löve2D - ANSI escape sequence in error-mode.fnl

Claude Marinier <claudem223@gmail.com>
Details
Message ID
<CAPg6usBUimHEj7cENQVqm9wmpEvYrDm5LOdSQyF81rZEx8w4Uw@mail.gmail.com>
DKIM signature
pass
Download raw message
Hi,

About     Alexander Griffith  /  min-love2d-fennel

https://gitlab.com/alexjgriffith/min-love2d-fennel/-/blob/master/error-mode.fnl?ref_type=heads

The color-msg function in error-mode.fnl captures the ANSI escape
sequences generated by Löve2D and converts them to a Lua table
containing pre, selected, and post string interspersed with color
triplets.

I believe the ANSI sequence for inverted text is

    Escape [ 7 m

The match function uses this pattern

    "(.*)\027%[7m(.*)\027%[0m(.*)"

The "%" matches a digit, right? Is this correct?

Thank you.

P. S. I am in GMail and I keep hitting Escape.  :-)

--
Claude Marinier
Details
Message ID
<8734mgkaup.fsf@asthra>
In-Reply-To
<CAPg6usBUimHEj7cENQVqm9wmpEvYrDm5LOdSQyF81rZEx8w4Uw@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
Claude Marinier <claudem223@gmail.com> writes:

> The match function uses this pattern
>
>     "(.*)\027%[7m(.*)\027%[0m(.*)"
>
> The "%" matches a digit, right? Is this correct?

No, in Lua patterns the % character indicates an escape code, so it's
just matching against a literal [ rather than using [] to denote
character set.

-Phi
Reply to thread Export thread (mbox)