Commit Graph

6 Commits

Author SHA1 Message Date
2b31632914 bin:no-ansi: Add a label to each pattern 2025-09-19 01:14:09 +02:00
27791acf50 bin:no-ansi: Correct allowed byte ranges
Correct the allowed byte ranges of the APC, DCS, OSC, PM & SOS
sequences. All but the SOS sequence allow additionally the bytes in the
range `0x8 - 0xD` and SOS may be followed by any sequence of bytes
except for SOS and ST (i.e. `\eX` & `\e\\`).

Link: https://www.ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_june_1991.pdf#page=27
2025-09-19 00:51:47 +02:00
8aa76b3ee6 bin:no-ansi: Don't just match CSI sequences
Try to match all ANSI escape sequences, not just CSI (i.e. `\e[`) - also
the ones that are followed by additional bytes (e.g. CSI, OSC).
2025-09-19 00:26:36 +02:00
6b866f5474 bin:no-ansi*: Use printf for escape byte
I dislike having the raw escape byte in these scripts. Unfortunately
`sed` does not support interpreting it via an escape sequence, so use
printf for that. To remain POSIX compatible use `\033` and not `\e` or
`\x1b` since I couldn't find these in the printf(1p) manpage.
Unfortunately this brings a second layer of escaping.
2025-09-19 00:13:28 +02:00
ca15f2399e bin:no-ansi: Fix final byte range
Don't know why I put `z`, the range goes until `~` (i.e. 0x7E).
2025-09-01 16:50:03 +02:00
8380d4cc29 bin: Add no-ansi to remove ANSI escape sequences
Similar to `no-ansi-sgr` but removes all ANSI escape sequence, not just
the SGR ones.

See the previous commit bbf9a1da58 (bin:no-ansi-sgr: Set LC_ALL=C for
`[0-?]` range, 2025-07-30) for an explanation of why LC_ALL has to be
set.
2025-08-04 11:00:14 +02:00