mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-25 04:28:30 +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 }) => {
|
.map(({ start, end }) => {
|
||||||
let from = tr.newDoc.line(start.line).from + start.column;
|
let from = tr.newDoc.line(start.line).from + start.column;
|
||||||
let to = tr.newDoc.line(end.line).from + end.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);
|
return highlightMark.range(from, to);
|
||||||
}),
|
})
|
||||||
|
.filter(Boolean),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user