Skip to content

Commit

Permalink
Fix a bug that could cause widgets at the start of a line to leak
Browse files Browse the repository at this point in the history
FIX: Fix a bug that could cause zero-length widgets at the start of a line
to be left in the view even after they were removed.

Closes codemirror/dev#1268
  • Loading branch information
marijnh committed Sep 29, 2023
1 parent d5b8c34 commit 315df18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/contentview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export function replaceRange(parent: ContentView, fromI: number, fromOff: number
} else {
// Remove the start of the after element, if necessary, and
// add it to `content`.
if (toOff) after.merge(0, toOff, null, false, 0, openEnd)
if (toOff || after.children.length && !after.children[0].length) after.merge(0, toOff, null, false, 0, openEnd)
insert.push(after)
}
} else if (after?.breakAfter) {
Expand Down

0 comments on commit 315df18

Please sign in to comment.