mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2026-10-25 00:02:16 +00:00
Merge pull request #240 from fredsa/errorclick
Improve compile error message click behavior
This commit is contained in:
4 files changed
+18
-2
No files matched your search
@@ -159,6 +159,9 @@ div.is-busy-unused {
|
||||
#error_alert_msg {
|
||||
margin-right: 2em;
|
||||
}
|
||||
#error_alert_msg a {
|
||||
cursor: pointer;
|
||||
}
|
||||
div.menu_div {
|
||||
position: absolute;
|
||||
width: 200px;
|
||||
|
||||
+1
-1
@@ -870,7 +870,7 @@ function getErrorElement(err: WorkerError) {
|
||||
link.click((ev) => {
|
||||
var wnd = projectWindows.createOrShow(path);
|
||||
if (wnd instanceof SourceEditor) {
|
||||
wnd.setCurrentLine(err, true);
|
||||
wnd.navigateToLine(err.line);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -341,6 +341,19 @@ export class SourceEditor implements ProjectView {
|
||||
});
|
||||
}
|
||||
|
||||
navigateToLine(line: number) {
|
||||
if (line < 1 || line > this.editor.state.doc.lines) return;
|
||||
const targetLine = this.editor.state.doc.line(line);
|
||||
this.editor.dispatch({
|
||||
selection: { anchor: targetLine.from },
|
||||
effects: [
|
||||
highlightLines.effect.of({ start: line, end: line }),
|
||||
EditorView.scrollIntoView(targetLine.from, { y: "center" }),
|
||||
],
|
||||
});
|
||||
this.editor.focus();
|
||||
}
|
||||
|
||||
getValue(): string {
|
||||
return this.editor.state.doc.toString();
|
||||
}
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ export class ProjectWindows {
|
||||
this.refreshErrors();
|
||||
wnd.setVisible && wnd.setVisible(true);
|
||||
this.id2showfn[id] && this.id2showfn[id](id, wnd);
|
||||
} else {
|
||||
} else if (moveCursor) {
|
||||
this.refresh(moveCursor);
|
||||
}
|
||||
this.activeid = id;
|
||||
|
||||
Reference in new issue
Block a user