Skip to content

Commit c84ea78

Browse files
committed
Do not remove and reapply spans that start before the removed media
1 parent c4572f2 commit c84ea78

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,16 +2254,15 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
22542254
text.getSpanEnd(blockSpan),
22552255
text.getSpanFlags(blockSpan)
22562256
)
2257-
}
2257+
}.filter { it.start >= start }
22582258
spans.forEach { temporarySpan ->
22592259
text.removeSpan(temporarySpan)
22602260
}
22612261
text.delete(start, endPlus1)
22622262
spans.forEach { temporarySpan ->
2263-
val newStart = if (temporarySpan.start >= start) temporarySpan.start - 2 else temporarySpan.start
22642263
text.setSpan(
22652264
temporarySpan.span,
2266-
newStart.coerceAtLeast(0),
2265+
(temporarySpan.start - 2).coerceAtLeast(0),
22672266
(temporarySpan.end - 2).coerceAtMost(text.length),
22682267
temporarySpan.flags
22692268
)

0 commit comments

Comments
 (0)