Tapping the More or Page format button will replace the selected text with the <!--more--> or <!--nextpage--> for any selected text.
Observed
Tapping More or Page format button crashes the app when the selecting text backwards with a keyboard. See the stack trace below for details.
06-06 10:32:32.135 2688-2688/org.wordpress.aztec E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.wordpress.aztec, PID: 7032
java.lang.IndexOutOfBoundsException: replace (4 ... 0) has end before start
at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1258)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:515)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:509)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:508)
at org.wordpress.aztec.formatting.LineBlockFormatter.applyComment(LineBlockFormatter.kt:115)
at org.wordpress.aztec.formatting.LineBlockFormatter.applyPageComment(LineBlockFormatter.kt:23)
at org.wordpress.aztec.AztecText.toggleFormatting(AztecText.kt:567)
at org.wordpress.aztec.toolbar.AztecToolbar.onToolbarAction(AztecToolbar.kt:335)
at org.wordpress.aztec.toolbar.AztecToolbar.access$onToolbarAction(AztecToolbar.kt:23)
at org.wordpress.aztec.toolbar.AztecToolbar$initView$1.onClick(AztecToolbar.kt:269)
at android.view.View.performClick(View.java:5637)
at android.widget.CompoundButton.performClick(CompoundButton.java:122)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Expected
Tapping the More or Page format button will replace the selected text with the
<!--more-->
or<!--nextpage-->
for any selected text.Observed
Tapping More or Page format button crashes the app when the selecting text backwards with a keyboard. See the stack trace below for details.
Reproduced
Tested
Google Pixel on Android 7.1.2 with AztecDemo 1.0