Skip to content

Commit 20aa9f7

Browse files
committed
fix: strip UTF-8 BOM before parsing settings.json in ponytail-activate (#148)
settings.json written by Notepad or VS Code on Windows can carry a UTF-8 BOM. JSON.parse then throws SyntaxError, the outer catch swallows it, hasStatusline stays false, and the statusline setup nudge is never emitted. Strip the leading BOM before parsing, matching the existing handling in ponytail-mode-tracker.js. (#96 added a null guard but not BOM stripping.)
1 parent adad50d commit 20aa9f7

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎hooks/ponytail-activate.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ let output = getPonytailInstructions(mode);
4343
if (!isCodex) try {
4444
let hasStatusline = false;
4545
if (fs.existsSync(settingsPath)) {
46-
const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
46+
// Strip UTF-8 BOM some editors prepend on Windows (breaks JSON.parse)
47+
const raw = fs.readFileSync(settingsPath, 'utf8').replace(/^\uFEFF/, '');
48+
const settings = JSON.parse(raw);
4749
if (settings.statusLine) {
4850
hasStatusline = true;
4951
}

0 commit comments

Comments
 (0)