massivemadness / Squircle-CE

👨‍💻 Squircle CE is a fast and free multi-language code editor for Android
https://play.google.com/store/apps/details?id=com.blacksquircle.ui
Apache License 2.0
1.39k stars 101 forks source link

Crash when deleting multiple chars #110

Closed qwerty287 closed 2 years ago

qwerty287 commented 2 years ago

Please consider making a Pull Request if you are capable of doing so.

App Version: 2021.1.4 Standard Edition

Affected Device(s): Android 11.0

Describe the bug I'm using the openboard keyboard which allows deleting multiple chars with a swipe over the deletion key. Squircle crashes then.

FATAL EXCEPTION: main
Process: com.blacksquircle.ui, PID: 12910
java.lang.IndexOutOfBoundsException: setSpan (5732 ... 5716) has end before start
    at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1318)
    at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:684)
    at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:676)
    at com.blacksquircle.ui.editorkit.widget.internal.SyntaxHighlightEditText.updateSyntaxHighlighting(SyntaxHighlightEditText.kt:319)
    at com.blacksquircle.ui.editorkit.widget.internal.SyntaxHighlightEditText.onScrollChanged(SyntaxHighlightEditText.kt:88)
    at com.blacksquircle.ui.editorkit.widget.TextProcessor.onScrollChanged(TextProcessor.kt:86)
    at android.view.View.scrollTo(View.java:18230)
    at android.widget.TextView.bringPointIntoView(TextView.java:9985)
    at android.widget.TextView.onPreDraw(TextView.java:7579)
    at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1093)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3091)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1954)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8180)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1056)
    at android.view.Choreographer.doCallbacks(Choreographer.java:878)
    at android.view.Choreographer.doFrame(Choreographer.java:811)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1041)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7697)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)

To Reproduce Steps to reproduce the behavior:

  1. Install openboard
  2. Delete multiple chars with a swipe
  3. See what happens

Expected behavior The chars are deleted.

massivemadness commented 2 years ago

Should be fixed in the next version