Skip to content

Commit 4a70c1d

Browse files
committed
🐞 frontend: Fix editor buglets (#116)
* Highlight first, not last error token in line * Fix empty/delete-all editor bug This merges the following commits: * frontend: Fix empty editor bug * frontend: Highlight first, not last error in line frontend/index.js | 4 +++- frontend/module/yace-editor.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) Pull-Request: #116
2 parents 151ff68 + ff5595e commit 4a70c1d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

β€Žfrontend/index.jsβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ function jsError(ptr, len) {
120120
const errorLines = {}
121121
for (const err of errs) {
122122
const g = err.match(re).groups
123-
errorLines[g.line] = { col: g.col, text: lines[g.line - 1] }
123+
if (!errorLines[g.line]) {
124+
errorLines[g.line] = { col: g.col, text: lines[g.line - 1] }
125+
}
124126
msgs += `line ${g.line}: ${g.msg}\n`
125127
}
126128
const output = document.querySelector("#console")

β€Žfrontend/module/yace-editor.jsβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ export default class Yace {
8181
) {
8282
return
8383
}
84-
this.value = value || this.value
84+
if (value != null && value != undefined) {
85+
this.value = value
86+
}
8587
this.errorLines = errorLines || this.errorLines
8688
const lines = this.value.split("\n")
8789
this.updateErrorLines(lines)

0 commit comments

Comments
Β (0)