From 976ebb116b6ab1c98d712da37698321818d74ec5 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 6 Apr 2026 12:04:22 +0100 Subject: [PATCH] fix: update indentation regex to match non-breaking spaces The auto-indent regex /^ */ only matched regular spaces. After preserving nbsp characters, browsers may use \xa0 for leading whitespace, causing auto-indentation to fail. Updated to /^[ \xa0]*/. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/static/js/ace2_inner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/static/js/ace2_inner.ts b/src/static/js/ace2_inner.ts index e1f5a90a9..daca0af50 100644 --- a/src/static/js/ace2_inner.ts +++ b/src/static/js/ace2_inner.ts @@ -1270,7 +1270,7 @@ function Ace2Inner(editorInfo, cssManagers) { const thisLine = rep.lines.atIndex(lineNum); const prevLine = rep.lines.prev(thisLine); const prevLineText = prevLine.text; - let theIndent = /^ *(?:)/.exec(prevLineText)[0]; + let theIndent = /^[ \xa0]*(?:)/.exec(prevLineText)[0]; const shouldIndent = window.clientVars.indentationOnNewLine; if (shouldIndent && /[[(:{]\s*$/.exec(prevLineText)) { theIndent += THE_TAB;