Skip to content

Commit

Permalink
Merge pull request #809 from wordpress-mobile/issue/808-bypass-inputf…
Browse files Browse the repository at this point in the history
…ilter-new-line

Prevent execution of InputFilter for new lines
  • Loading branch information
mzorz authored Apr 16, 2019
2 parents 1400adb + 37b282a commit 0e79d2f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,11 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
// https://android-review.googlesource.com/c/platform/frameworks/base/+/634929
val dynamicLayoutCrashPreventer = InputFilter { source, start, end, dest, dstart, dend ->
var temp : CharSequence? = null
if (!bypassCrashPreventerInputFilter && dstart == dend && dest.length > dend+1) {
if (!bypassCrashPreventerInputFilter
&& dstart == dend && dest.length > dend+1
&& source != Constants.NEWLINE_STRING) {
// dstart == dend means this is an insertion
// avoid handling anything if it's a newline
// if there are any images right after the destination position, hack the text
val spans = dest.getSpans(dstart, dend+1, AztecImageSpan::class.java)
if (spans.isNotEmpty()) {
Expand Down

0 comments on commit 0e79d2f

Please sign in to comment.