fix(parse): strip OSC escape sequences in StripAnsi for backwards compat

This commit is contained in:
Mortdecai
2026-04-07 20:05:16 -04:00
parent b3bbd55551
commit 84018efbbf
2 changed files with 73 additions and 1 deletions
+5 -1
View File
@@ -11,7 +11,11 @@ import (
"git.sr.ht/~rjarry/aerc/lib/log"
)
var AnsiReg = regexp.MustCompile("\x1B\\[[0-?]*[ -/]*[@-~]")
var AnsiReg = regexp.MustCompile(
`\x1B\[[0-?]*[ -/]*[@-~]` + // CSI sequences: ESC [ ... final_byte
`|` +
`\x1B\][^\x07\x1B]*(?:\x07|\x1B\\)`, // OSC sequences: ESC ] ... (BEL | ESC \)
)
// StripAnsi strips ansi escape codes from the reader
func StripAnsi(r io.Reader) io.Reader {