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) <noreply@anthropic.com>
This commit is contained in:
John McLear 2026-04-06 12:04:22 +01:00
parent 18013c89db
commit 976ebb116b

View file

@ -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;