1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2026-04-20 00:17:04 +00:00

fix highlightLines lines and scroll position

This commit is contained in:
Fred Sauer
2026-02-18 22:16:26 -08:00
parent ff6a0e666a
commit 80c619c822
+5 -7
View File
@@ -298,14 +298,12 @@ export class SourceEditor implements ProjectView {
}
highlightLines(start: number, end: number) {
const startLine = this.editor.state.doc.line(start + 1);
this.editor.dispatch({
effects: highlightLines.effect.of({ start, end })
});
// Scroll to show start of the highlighted range.
const startLine = this.editor.state.doc.line(start);
const endLine = this.editor.state.doc.line(end);
this.editor.dispatch({
effects: EditorView.scrollIntoView(startLine.from, { y: "center" })
effects: [
highlightLines.effect.of({ start: start + 1, end: end + 1 }),
EditorView.scrollIntoView(startLine.from, { y: "start", yMargin: 100/*pixels*/ }),
]
});
}