From 75fb2f56a25df07ecb8a57798fec0a5ad667e23b Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Wed, 30 Jul 2025 17:01:48 +0200 Subject: [PATCH] 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. --- .local/bin/no-ansi-sgr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.local/bin/no-ansi-sgr b/.local/bin/no-ansi-sgr index acc41aa..3565750 100755 --- a/.local/bin/no-ansi-sgr +++ b/.local/bin/no-ansi-sgr @@ -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