Skip to content

Commit e5dacfe

Browse files
committed
Improve handling of selection of empty editor with only END_OF_BUFFER_MARKER.
1 parent 806c3a4 commit e5dacfe

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,10 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
12381238
}
12391239

12401240
if (length() != 0) {
1241+
if((length() == 1 && text[0] == Constants.END_OF_BUFFER_MARKER)){
1242+
return
1243+
}
1244+
12411245
// if the text end has the marker, let's make sure the cursor never includes it or surpasses it
12421246
if ((selStart == length() || selEnd == length()) && text[length() - 1] == Constants.END_OF_BUFFER_MARKER) {
12431247
var start = selStart
@@ -1972,14 +1976,6 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
19721976
return super.onTextContextMenuItem(id)
19731977
}
19741978
}
1975-
android.R.id.selectAll -> {
1976-
return if (text.toString() == Constants.END_OF_BUFFER_MARKER.toString()) {
1977-
deleteInlineStyleFromTheBeginning()
1978-
return true
1979-
} else {
1980-
super.onTextContextMenuItem(id)
1981-
}
1982-
}
19831979
else -> return super.onTextContextMenuItem(id)
19841980
}
19851981

0 commit comments

Comments
 (0)