Skip to content

Commit 0e79d2f

Browse files
authored
Merge pull request #809 from wordpress-mobile/issue/808-bypass-inputfilter-new-line
Prevent execution of InputFilter for new lines
2 parents 1400adb + 37b282a commit 0e79d2f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,11 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
462462
// https://android-review.googlesource.com/c/platform/frameworks/base/+/634929
463463
val dynamicLayoutCrashPreventer = InputFilter { source, start, end, dest, dstart, dend ->
464464
var temp : CharSequence? = null
465-
if (!bypassCrashPreventerInputFilter && dstart == dend && dest.length > dend+1) {
465+
if (!bypassCrashPreventerInputFilter
466+
&& dstart == dend && dest.length > dend+1
467+
&& source != Constants.NEWLINE_STRING) {
466468
// dstart == dend means this is an insertion
469+
// avoid handling anything if it's a newline
467470
// if there are any images right after the destination position, hack the text
468471
val spans = dest.getSpans(dstart, dend+1, AztecImageSpan::class.java)
469472
if (spans.isNotEmpty()) {

0 commit comments

Comments
 (0)