Index out of range problem in TextLine.

Recent refactoring for bidi introduced an index shift in the getOffsetBeforeAfter
method. This problem appears for multi-line text input only, when the text line
mStart index is not 0.

As a result, moving the cursor using the trackball in a multi-line EditText crashes.

Change-Id: I1f121f0f9272ef7d338399f369ba6d77e1ca71c5
This commit is contained in:
Gilles Debunne
2010-06-16 17:13:23 -07:00
parent 2f7a247c92
commit 345cb03315

View File

@@ -54,7 +54,7 @@ class TextLine {
private char[] mChars;
private boolean mCharsValid;
private Spanned mSpanned;
private TextPaint mWorkPaint = new TextPaint();
private final TextPaint mWorkPaint = new TextPaint();
private static TextLine[] cached = new TextLine[3];
@@ -658,7 +658,7 @@ class TextLine {
flags, offset, cursorOpt);
} else {
return wp.getTextRunCursor(mText, mStart + spanStart,
mStart + spanLimit, flags, mStart + offset, cursorOpt);
mStart + spanLimit, flags, mStart + offset, cursorOpt) - mStart;
}
}