diff --git a/edit/codemirror-editing-hooks.js b/edit/codemirror-editing-hooks.js index f2923894..3a8d436f 100644 --- a/edit/codemirror-editing-hooks.js +++ b/edit/codemirror-editing-hooks.js @@ -623,6 +623,10 @@ onDOMscriptReady('/codemirror.js').then(() => { }).then(() => { errors.classList.add('hidden'); }).catch(err => { + if (err && editor && !Number.isNaN(err.index)) { + const pos = editors[0].posFromIndex(err.index); + err = `${pos.line}:${pos.ch} ${err}`; + } errors.classList.remove('hidden'); errors.onclick = () => messageBox.alert(String(err), 'pre'); }); diff --git a/js/usercss.js b/js/usercss.js index cffa2204..46e213c7 100644 --- a/js/usercss.js +++ b/js/usercss.js @@ -450,8 +450,8 @@ var usercss = (() => { try { doParse(); } catch (e) { - // grab additional info - e.index = metaIndex; + // the source code string offset + e.index = metaIndex + state.re.lastIndex; throw e; }