A vibe coded tangled fork which supports pijul.
at 2eef6d64d11ba9e9dc550d231960e7944be4371d 21 lines 489 B view raw
1package nixery 2 3import ( 4 "io" 5 6 "regexp" 7) 8 9// regex to match ANSI escape codes (e.g., color codes, cursor moves) 10const ansi = "[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))" 11 12var re = regexp.MustCompile(ansi) 13 14type ansiStrippingWriter struct { 15 underlying io.Writer 16} 17 18func (w *ansiStrippingWriter) Write(p []byte) (int, error) { 19 clean := re.ReplaceAll(p, []byte{}) 20 return w.underlying.Write(clean) 21}