Skip to content

Commit d8e718e

Browse files
committed
Remove end check in favor of checking the resulting source string's content
1 parent 20b46e1 commit d8e718e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
632632

633633
val emptyEditTextBackspaceDetector = InputFilter { source, start, end, dest, dstart, dend ->
634634
if (selectionStart == 0 && selectionEnd == 0
635-
&& end == 1 && start == 0
635+
&& start == 0
636636
&& dstart == 0 && dend == 0
637637
&& isCleanStringEmpty(source)
638638
&& !isHandlingBackspaceEvent) {
@@ -656,7 +656,11 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
656656
}
657657

658658
private fun isCleanStringEmpty(text: CharSequence): Boolean {
659-
return (text.count() == 1 && text[0] == Constants.END_OF_BUFFER_MARKER)
659+
if( isInGutenbergMode ) {
660+
return (text.count() == 1 && text[0] == Constants.END_OF_BUFFER_MARKER)
661+
} else {
662+
return text.count() == 0
663+
}
660664
}
661665

662666
private fun handleBackspaceAndEnter(event: KeyEvent): Boolean {

0 commit comments

Comments
 (0)