aboutsummaryrefslogtreecommitdiff
path: root/docs/repl.js
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-02-17 21:41:04 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-02-17 21:52:30 -0500
commit3937808e13851e2e0b6346a752dbe5e49a15d27b (patch)
treecd311b73b776591060cfcddf4233ad5295ffcf5c /docs/repl.js
parentb877e450b2814c51693f32b9e1f1f33538ef6081 (diff)
Fix formatting of error locations that meet or overlap
Diffstat (limited to 'docs/repl.js')
-rw-r--r--docs/repl.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/repl.js b/docs/repl.js
index 501d3b61..79e5781b 100644
--- a/docs/repl.js
+++ b/docs/repl.js
@@ -111,11 +111,11 @@ let highlightErr = (s, e) => {
if (!is.sh) { n=1; is=[is]; }
else { n=is.sh[0]; pair=is.sh.length>1; if(pair)n*=2; }
let l=0, sl = j=>s.slice(l,l=j).join('');
- for (let i=0; i<n; i) {
- h.append(sl(is[i++]));
+ for (let i=0; i<n; ) {
+ let b=is[i++]; h.append(sl(b));
+ if (pair) for (b=is[i++]; i<n&&b+1>=is[i]; i+=2) b=is[i+1];
let m = document.createElement('mark');
- m.innerText = sl((pair?is[i++]:l)+1);
- h.append(m);
+ m.innerText = sl(b+1); h.append(m);
}
h.append(sl());
}