From 6a60a2163a9484daa7bbeb01e03738ac0ff1453b Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Wed, 20 Sep 2023 13:51:50 +0200 Subject: [PATCH] Fix a bug in DOM updates FIX: Fix a bug that could cause the document DOM to be incorrectly updated on some types of viewport changes. Closes https://github.com/codemirror/dev/issues/1258 --- src/contentview.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/contentview.ts b/src/contentview.ts index 11c48f5..5b6640d 100644 --- a/src/contentview.ts +++ b/src/contentview.ts @@ -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) {