mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-13 06:19:33 -04:00
fix: dont highlight out of range
This commit is contained in:
@@ -26,8 +26,13 @@ const highlightField = StateField.define({
|
||||
.map(({ start, end }) => {
|
||||
let from = tr.newDoc.line(start.line).from + start.column;
|
||||
let to = tr.newDoc.line(end.line).from + end.column;
|
||||
const l = tr.newDoc.length;
|
||||
if (from > l || to > l) {
|
||||
return;
|
||||
}
|
||||
return highlightMark.range(from, to);
|
||||
}),
|
||||
})
|
||||
.filter(Boolean),
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user