Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IndexOutOfBoundsException: setSpan() #848

Open
yangshibai opened this issue Aug 28, 2019 · 2 comments
Open

java.lang.IndexOutOfBoundsException: setSpan() #848

yangshibai opened this issue Aug 28, 2019 · 2 comments

Comments

@yangshibai
Copy link

yangshibai commented Aug 28, 2019

When set aztec.visualEditor.filters = arrayOf(InputFilter.LengthFilter(1000)) ,it menas EditText MaxLength is 1000,next I paste piece of text with more than 500 words, the
first time is all right ,but the second time I continue paste this text ,the application crashed。

This is the crash Log:

java.lang.IndexOutOfBoundsException: setSpan (1272 ... 1272) ends beyond length 1000
at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1309)
at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:680)
at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:672)
at android.text.Selection.setSelection(Selection.java:76)
at android.text.Selection.setSelection(Selection.java:87)
at android.widget.EditText.setSelection(EditText.java:127)
at org.wordpress.aztec.AztecText.fromHtml(AztecText.kt:1158)
at org.wordpress.aztec.AztecText.paste(AztecText.kt:1598)
at org.wordpress.aztec.AztecText.paste$default(AztecText.kt:1557)
at org.wordpress.aztec.AztecText.onTextContextMenuItem(AztecText.kt:1493)
at android.widget.Editor$ActionPopupWindow.onClick(Editor.java:4327)
at android.view.View.performClick(View.java:6266)
at android.widget.TouchPanelLayout.resetChildState(TouchPanelLayout.java:58)
at android.widget.TouchPanelLayout.dispatchTouchEvent(TouchPanelLayout.java:46)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2963)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2963)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
at android.widget.PopupWindow$PopupDecorView.dispatchTouchEvent(PopupWindow.java:2397)
at android.view.View.dispatchPointerEvent(View.java:11975)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4836)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4647)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4183)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4236)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4202)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4329)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4210)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4386)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4183)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4236)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4202)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4210)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4183)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6743)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6717)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6678)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6849)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:249)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:325)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:6698)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:782)

Finally I found this method in AztecText class : consumeCursorPosition() calculate is wrong

@Riya1295
Copy link

Any update or any solution for this issue?

@Bibazavr
Copy link

Hello!

I'm facing same error and sure that problem happened there

Because lib setting cursor while ignoring all filters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants