Skip to content

Commit

Permalink
Join adjacent overlay ranges in mixed parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Jan 18, 2024
1 parent 76f2240 commit 12e3182
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/mix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ class MixedParse implements PartialParse {
}
} else if (overlay && (range = overlay.predicate(cursor))) {
if (range === true) range = new Range(cursor.from, cursor.to)
if (range.from < range.to) overlay.ranges.push(range)
if (range.from < range.to) {
let last = overlay.ranges.length - 1
if (last >= 0 && overlay.ranges[last].to == range.from)
overlay.ranges[last] = {from: overlay.ranges[last].from, to: range.to}
else
overlay.ranges.push(range)
}
}
if (enter && cursor.firstChild()) {
if (overlay) overlay.depth++
Expand Down

0 comments on commit 12e3182

Please sign in to comment.