Skip to content

Commit

Permalink
Fix an update bug in MatchDecorator
Browse files Browse the repository at this point in the history
FIX: Fix a crash in MatchDecorator when updating matches at the end of the document.

See https://discuss.codemirror.net/t/the-problem-of-multiple-extension-implementations/8917
  • Loading branch information
marijnh committed Dec 19, 2024
1 parent 08b3af0 commit 572ab76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/matchdecorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class MatchDecorator {
updateDeco(update: ViewUpdate, deco: DecorationSet) {
let changeFrom = 1e9, changeTo = -1
if (update.docChanged) update.changes.iterChanges((_f, _t, from, to) => {
if (to > update.view.viewport.from && from < update.view.viewport.to) {
if (to >= update.view.viewport.from && from <= update.view.viewport.to) {
changeFrom = Math.min(from, changeFrom)
changeTo = Math.max(to, changeTo)
}
Expand Down

0 comments on commit 572ab76

Please sign in to comment.