From 99362f1e5fcce0e2093c76052a1178bbe4113a72 Mon Sep 17 00:00:00 2001 From: Joshua Shanks Date: Mon, 19 Jan 2026 12:47:49 -0800 Subject: [PATCH] fix: clamp progress bar value to 0-100 range (#176) Prevents visual glitches if context usage reports unexpected values outside the expected 0-100 percentage range. --- hooks/statusline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/statusline.js b/hooks/statusline.js index 400e7eaca..6083c07c1 100755 --- a/hooks/statusline.js +++ b/hooks/statusline.js @@ -22,7 +22,7 @@ process.stdin.on('end', () => { let ctx = ''; if (remaining != null) { const rem = Math.round(remaining); - const used = 100 - rem; + const used = Math.max(0, Math.min(100, 100 - rem)); // Build progress bar (10 segments) const filled = Math.floor(used / 10);