fixed highlighting issue

This commit is contained in:
Dsm0
2026-01-18 23:43:11 -08:00
parent 9bcaaa3ac4
commit 87e723649e
+1 -3
View File
@@ -25,7 +25,6 @@ const miniLocations = StateField.define({
//block-based eval case
if (e.value.range) {
const stateMiniLocations = getMiniLocationsFromDecorations(locations);
const existingById = new Map(stateMiniLocations.map(({ id, from, to }) => [id, [from, to]]));
const normalized = e.value.locations
.filter(([from]) => from < tr.newDoc.length)
@@ -35,13 +34,12 @@ const miniLocations = StateField.define({
const marks = normalized.map((range) => {
const id = range.join(':');
const useRange = existingById.get(id) || range;
return Decoration.mark({
id,
// this green is only to verify that the decoration moves when the document is edited
// it will be removed later, so the mark is not visible by default
attributes: { style: `background-color: #00CA2880` },
}).range(...useRange); // -> Decoration
}).range(...range); // -> Decoration
});
const previousMarks = stateMiniLocations