From 11569933a30ec7e5479ecc572e4aa6724fd6c11b Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 19 Jan 2026 17:19:15 +0100 Subject: [PATCH] fix(inner-loop): improve ANSI escape code stripping Expand ANSI regex to match all escape sequences (cursor movement, color codes, etc.) not just color codes. This fixes todo content having residual escape sequences like cursor movements. Co-Authored-By: Claude Opus 4.5 --- src/inner-loop-tracker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/inner-loop-tracker.ts b/src/inner-loop-tracker.ts index 2739c280..83d24334 100644 --- a/src/inner-loop-tracker.ts +++ b/src/inner-loop-tracker.ts @@ -43,7 +43,8 @@ const MAX_ITERATIONS_PATTERN = /max[_-]?iterations?\s*[=:]\s*(\d+)/i; const TODOWRITE_PATTERN = /TodoWrite|todo(?:s)?\s*(?:updated|written|saved)|Todos have been modified/i; // ANSI escape code removal for cleaner parsing -const ANSI_ESCAPE_PATTERN = /\x1b\[[0-9;]*m/g; +// Matches color codes (\x1b[...m), cursor movement (\x1b[...H, \x1b[...C, etc.), and other sequences +const ANSI_ESCAPE_PATTERN = /\x1b\[[0-9;]*[A-Za-z]/g; export interface InnerLoopTrackerEvents { loopUpdate: (state: InnerLoopState) => void;