mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 21:58:31 +00:00
fix: dont highlight out of range
This commit is contained in:
parent
cf922b036e
commit
9e46b3cd00
@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user