Simplification

pull/215/head
M66B 7 months ago
parent 7f96e25ff8
commit ff97ce5b3e

@ -1771,35 +1771,36 @@ public class StyleHelper {
for (InsertedSpan span : text.getSpans(0, text.length(), InsertedSpan.class))
text.removeSpan(span);
if (start >= 0 && start < end && end <= text.length()) {
/*
java.lang.IndexOutOfBoundsException: Invalid Context Range: 0, 1 must be in 0, 0
at android.graphics.Paint.getRunCharacterAdvance(Paint.java:3541)
at android.text.TextLine.getRunAdvance(TextLine.java:1274)
at android.text.TextLine.handleText(TextLine.java:1361)
at android.text.TextLine.handleRun(TextLine.java:1640)
at android.text.TextLine.measureRun(TextLine.java:882)
at android.text.TextLine.measure(TextLine.java:604)
at android.text.TextLine.metrics(TextLine.java:494)
at android.text.Layout.getLineExtent(Layout.java:1896)
at android.text.Layout.getLineMax(Layout.java:1843)
at android.text.Layout.getLineRight(Layout.java:1833)
at android.widget.TextView.getCursorAnchorInfo(TextView.java:14517)
at android.widget.Editor$CursorAnchorInfoNotifier.updatePosition(Editor.java:4883)
at android.widget.Editor$PositionListener.onPreDraw(Editor.java:3750)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1176)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4158)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2836)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10145)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1406)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1415)
at android.view.Choreographer.doCallbacks(Choreographer.java:1015)
at android.view.Choreographer.doFrame(Choreographer.java:945)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1389)
at android.os.Handler.handleCallback(Handler.java:959)
*/
Pair<Integer, Integer> range = ensureParagraph(text, start, end);
if (range != null)
text.setSpan(new InsertedSpan(), range.first, range.second, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
if (start == 0) {
/*
java.lang.IndexOutOfBoundsException: Invalid Context Range: 0, 1 must be in 0, 0
at android.graphics.Paint.getRunCharacterAdvance(Paint.java:3541)
at android.text.TextLine.getRunAdvance(TextLine.java:1274)
at android.text.TextLine.handleText(TextLine.java:1361)
at android.text.TextLine.handleRun(TextLine.java:1640)
at android.text.TextLine.measureRun(TextLine.java:882)
at android.text.TextLine.measure(TextLine.java:604)
at android.text.TextLine.metrics(TextLine.java:494)
at android.text.Layout.getLineExtent(Layout.java:1896)
at android.text.Layout.getLineMax(Layout.java:1843)
at android.text.Layout.getLineRight(Layout.java:1833)
at android.widget.TextView.getCursorAnchorInfo(TextView.java:14517)
at android.widget.Editor$CursorAnchorInfoNotifier.updatePosition(Editor.java:4883)
at android.widget.Editor$PositionListener.onPreDraw(Editor.java:3750)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1176)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4158)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2836)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10145)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1406)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1415)
at android.view.Choreographer.doCallbacks(Choreographer.java:1015)
at android.view.Choreographer.doFrame(Choreographer.java:945)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1389)
at android.os.Handler.handleCallback(Handler.java:959)
*/
return;
}
text.setSpan(new InsertedSpan(), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}

Loading…
Cancel
Save