Skip to content

Commit d0ff0cb

Browse files
committed
Fixed infinite loop.
1 parent 19c26c6 commit d0ff0cb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/watchers/TextDeleter.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ class TextDeleter private constructor(aztecText: AztecText) : TextWatcher {
2121
return
2222
}
2323

24-
aztecTextRef.get()?.text?.let { text ->
25-
text.getSpans(0, text.length, MarkForDeletion::class.java).forEach {
26-
val start = text.getSpanStart(it)
27-
val end = text.getSpanEnd(it)
28-
29-
if (start > -1 && end > -1) {
30-
text.delete(text.getSpanStart(it), text.getSpanEnd(it))
31-
}
24+
text.getSpans(0, text.length, MarkForDeletion::class.java).forEach {
25+
val start = text.getSpanStart(it)
26+
val end = text.getSpanEnd(it)
27+
28+
if (start > -1 && end > -1) {
29+
aztecTextRef.get()?.disableTextChangedListener()
30+
text.delete(start, end)
31+
aztecTextRef.get()?.enableTextChangedListener()
3232
}
3333
}
3434
}

0 commit comments

Comments
 (0)