ScuttleBot

fix: filter bracketed paste mode escapes from PTY mirror [?2026l and [?2026h sequences were leaking into IRC when split across read chunks. Added pattern to both ansiRE and noiseRE.

lmata 2026-04-05 23:17 trunk
Commit 46ba17d882f9a5520a8f99ff7e4c80b6943b37191109d9d47f4ff2f89648758f
1 file changed +3 -3
--- pkg/relaymirror/pty.go
+++ pkg/relaymirror/pty.go
@@ -11,15 +11,15 @@
1111
"strings"
1212
"sync"
1313
"time"
1414
)
1515
16
-// ansiRE matches ANSI escape sequences.
17
-var ansiRE = regexp.MustCompile(`\x1b\[[0-9;]*[a-zA-Z]|\x1b\].*?\x07|\x1b\(B`)
16
+// ansiRE matches ANSI escape sequences (including partial/split ones).
17
+var ansiRE = regexp.MustCompile(`\x1b\[[0-9;?]*[a-zA-Z]|\x1b\].*?\x07|\x1b\(B|\[\?[0-9]+[hl]`)
1818
1919
// noiseRE matches common terminal noise: spinner chars, progress bars, cursor movement.
20
-var noiseRE = regexp.MustCompile(`^[⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏\-\\|/]+$|^\s*\d+%\s*$|^[.]+$`)
20
+var noiseRE = regexp.MustCompile(`^[⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏\-\\|/]+$|^\s*\d+%\s*$|^[.]+$|^\[?\?[0-9]+[hl]`)
2121
2222
// PTYMirror reads PTY output and emits clean text lines to IRC.
2323
// It includes rate limiting and noise filtering for clean IRC output.
2424
type PTYMirror struct {
2525
maxLineLen int
2626
--- pkg/relaymirror/pty.go
+++ pkg/relaymirror/pty.go
@@ -11,15 +11,15 @@
11 "strings"
12 "sync"
13 "time"
14 )
15
16 // ansiRE matches ANSI escape sequences.
17 var ansiRE = regexp.MustCompile(`\x1b\[[0-9;]*[a-zA-Z]|\x1b\].*?\x07|\x1b\(B`)
18
19 // noiseRE matches common terminal noise: spinner chars, progress bars, cursor movement.
20 var noiseRE = regexp.MustCompile(`^[⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏\-\\|/]+$|^\s*\d+%\s*$|^[.]+$`)
21
22 // PTYMirror reads PTY output and emits clean text lines to IRC.
23 // It includes rate limiting and noise filtering for clean IRC output.
24 type PTYMirror struct {
25 maxLineLen int
26
--- pkg/relaymirror/pty.go
+++ pkg/relaymirror/pty.go
@@ -11,15 +11,15 @@
11 "strings"
12 "sync"
13 "time"
14 )
15
16 // ansiRE matches ANSI escape sequences (including partial/split ones).
17 var ansiRE = regexp.MustCompile(`\x1b\[[0-9;?]*[a-zA-Z]|\x1b\].*?\x07|\x1b\(B|\[\?[0-9]+[hl]`)
18
19 // noiseRE matches common terminal noise: spinner chars, progress bars, cursor movement.
20 var noiseRE = regexp.MustCompile(`^[⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏\-\\|/]+$|^\s*\d+%\s*$|^[.]+$|^\[?\?[0-9]+[hl]`)
21
22 // PTYMirror reads PTY output and emits clean text lines to IRC.
23 // It includes rate limiting and noise filtering for clean IRC output.
24 type PTYMirror struct {
25 maxLineLen int
26

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button