Skip to content

Commit

Permalink
Fix a bug in DOM updates
Browse files Browse the repository at this point in the history
FIX: Fix a bug that could cause the document DOM to be incorrectly updated on
some types of viewport changes.

Closes codemirror/dev#1258
  • Loading branch information
marijnh committed Sep 20, 2023
1 parent c0e108a commit 6a60a21
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 @@ -292,7 +292,7 @@ export function replaceRange(parent: ContentView, fromI: number, fromOff: number
if (toI < children.length) {
let after = children[toI]
// Make sure the end of the child after the update is preserved in `after`
if (after && toOff < after.length) {
if (after && (toOff < after.length || after.breakAfter && last?.breakAfter)) {
// If we're splitting a child, separate part of it to avoid that
// being mangled when updating the child before the update.
if (fromI == toI) {
Expand Down

0 comments on commit 6a60a21

Please sign in to comment.