Skip to content

Commit a3bc7db

Browse files
authored
fix: strip UTF-8 BOM before parsing settings.json in ponytail-activate (#148) (#151)
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 55b7cb1 commit a3bc7db

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)