OSDN Git Service

Fix incorrect calculation of start and end indices of changed text
authorViktor Yakovel <viktor.yakovel@sonyericsson.com>
Wed, 17 Feb 2010 07:35:57 +0000 (08:35 +0100)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 5 Aug 2011 08:05:31 +0000 (16:05 +0800)
commit131f4eaef9c74ef94110500037e694466a1cf7f6
tree3ef4b9cb39c10fb8159014c55fc0441b9393953c
parent557cd4f65e516f03f37e11c59bd83cc8b4190b8b
Fix incorrect calculation of start and end indices of changed text

- The problem is taht the calculation of indices does not take the
  difference in original and modified text lengths into account.
- If reportExtractedText() is called from the onDraw() function,
  mInputMethodState is not reset.

The error can occur when the user is editing formatted text using a full screen editor.
One example of formatted text is phone numbers (e.g. dashes are added to North American
numbers by the PhoneNumberFormattingTextWatcher class).
If the two first digits are removed from the number 555-666-777, the new number becomes 566--777.
This is due incorrect calculation of start and end indices of the changed text. The error is in
the TextView class and the problem is that the calculation does not take the difference in original
and modified text lengths into account.

Change-Id: If12d0f571873a6f1874102377432affb64ee21e8
core/java/android/widget/TextView.java