diff --git a/src/ui/app.css b/src/ui/app.css index 7b5bc08..12144ce 100644 --- a/src/ui/app.css +++ b/src/ui/app.css @@ -21,6 +21,7 @@ --border: #e4e4e0; --sel: #cfe3f7; --caret: #d57d2c; + --error: #c1443a; --toolbar-bg: #fafaf8; --hover: #ececea; } @@ -41,6 +42,7 @@ --border: #333438; --sel: #2d4a68; --caret: #e8923c; + --error: #e2685c; --toolbar-bg: #232428; --hover: #2f3035; } @@ -332,6 +334,10 @@ body { text-overflow: ellipsis; } .result-line:hover { text-decoration: underline; } +.result-line.result-error { + color: var(--error); + font-style: italic; +} .result-sparkline { position: absolute; right: 14px; diff --git a/src/ui/editor.ts b/src/ui/editor.ts index 0699eed..247a544 100644 --- a/src/ui/editor.ts +++ b/src/ui/editor.ts @@ -324,7 +324,8 @@ export class SumEditor { for (let i = 0; i < Math.min(this.results.length, doc.lines); i++) { const r = this.results[i]; const isChart = r.value?.kind === "chart"; - if (!r.text && !isChart) continue; + const isError = !!r.error; + if (!r.text && !isChart && !isError) continue; const line = doc.line(i + 1); const block = this.view.lineBlockAt(line.from); const top = docTop + block.top - overlayTop; @@ -333,9 +334,10 @@ export class SumEditor { frag.appendChild(buildSparkline(r.value.points.map((p) => p.toNumber()), top)); } else { const el = document.createElement("div"); - el.className = "result-line"; - el.textContent = r.text; - el.dataset.value = r.text!; + el.className = "result-line" + (isError ? " result-error" : ""); + el.textContent = isError ? "#ref?" : r.text; + if (!isError) el.dataset.value = r.text!; + if (isError) el.title = r.error!; el.style.top = `${top}px`; frag.appendChild(el); }