bin:no-ansi-sgr: Conform to specification

Previously - in the existence of other ANSI escape sequences - the
script deleted text due to the too broad regex. For example in:

    foo^[[K bar m

everything behind `foo` was deleted. Thus, only remove SGR sequences by
only matching the spec-allowed bytes.
This commit is contained in:
2025-07-30 17:01:48 +02:00
parent 1ee41e1c5b
commit 75fb2f56a2

View File

@@ -5,4 +5,5 @@
# Remove ANSI SGR (Select Graphic Rendition) escape sequences, e.g. setting
# color or bold font.
s/\[[^m]*m//g
# TODO: Why is the range `[0-?]` invalid?
s/\[[0-9:-?]*[ -/]*m//g