4e51877f5cbdb4a92568dce50c2bdc381cfbe861 |
|
27-Mar-2018 |
Clara Bayarri <clarabayarri@google.com> |
Fix crash when modifying Selection The root of this bug was in the fact that Selection.removeSelection removes two spans, the start index and end index of the selection. Each span removal triggers Editor#onSpanRemoved, which in turn tries to set a selection. This meant that if we started with selection (100, 120), then removeSpan(start) was called, so we had (-1, 120), then the onSpanRemoved code tried to set a selection so set it to (120, 120), then removeSpan(end) was called, ending up in (120, -1). There are two stages to this fix 1. A lot of our code assumes that when either start or end selection are larger than -1, both are valid. Therefore when we have one of them out of sync, we crash. Fixed this assumption in all the places I found 2. We didn't have a mechanism to use FLAG_INTERMEDIATE when removing spans, only when adding them, so this CL adds a remove with flags. This allows us to not trigger onSpanRemoved when only one of the selection indexes is removed. Because this is an added method to an interface, the default just calls the existing method. The new method is implemented in SpannableStringInternal and SpannableStringBuilder to read FLAG_INTERMEDIATE and avoid sending a spans changed event. Selection.removeSelection then uses FLAG_INTERMEDIATE when removing the first of the two selection spans. Note that 2. would be enough to fix the current bug, but we want to avoid other implementations of Spannable from crashing in the wild. In general, it seems like a good idea to verify both selection indexes are valid whenever they are used. Bug: 72101848 Test: atest FrameworksCoreTests:SpannableStringBuilderTest Test: atest FrameworksCoreTests:SpannableStringTest Test: atest CtsWidgetTestCases:TextViewTest Test: atest CtsWidgetTestCases:EditTextTest Test: atest android.text.cts.SelectionTest (note new test as well) Test: atest android.view.inputmethod.cts.BaseInputConnectionTest Test: atest android.text.DynamicLayoutTest Change-Id: I0d647fad152d0bef0f2115a46c3d17ebd8642281
/frameworks/base/core/java/android/text/Selection.java
|
6c66f86778586352b79e845b1a65bf467d9ba695 |
|
26-May-2016 |
Clara Bayarri <clarabayarri@google.com> |
Make up/down movement of multilength lines remember position Test: Separate CTS CL being submitted along this one, see topic Bug: 25486843 Change-Id: I463c126b07db05b1c4a26e870cde5c5567471da0
/frameworks/base/core/java/android/text/Selection.java
|
fb0431b5253346feb38677138e1a0a5458abaf57 |
|
05-Sep-2014 |
Raph Levien <raph@google.com> |
Up/down arrow moves to beginning/end of buffer With a hardware keyboard, using up arrow within the top line should move to the beginning of the buffer, to better match desktop text editing expectations, and similarly for down arrow on the last line. This patch implements that behavior. Bug: 17385784 Change-Id: Ia23c23c9cc2462558bca9aaffec7d83e284d55e8
/frameworks/base/core/java/android/text/Selection.java
|
e193fd14346e6e808c6c266d2bb13c0c0cc6890e |
|
18-Apr-2011 |
Gilles Debunne <debunne@google.com> |
Extracted WordIterator class. This class will be used by TextView and the IMEs to cut the text into words. New getBeginning and getEnd methods that return word limits. Added Locale to constructor. Change-Id: Ie8ad590ebca4b48517ec7b4c3768b3e41879166e
/frameworks/base/core/java/android/text/Selection.java
|
e982dfc1bae36620f67371efc7b0a0f8adc9450d |
|
22-Mar-2011 |
Jeff Sharkey <jsharkey@android.com> |
Support Ctrl-based EditText movement. EditText now listens for Ctrl+left/right to jump through text at word boundaries. It also listens for Ctrl+home/end to move to start/end of the full text. This emulates behavior found in desktop text editors. Bug: 4081964 Change-Id: I98bd19c0d8707357847db3466648a83fd774dbaf
/frameworks/base/core/java/android/text/Selection.java
|
2d0e87b64402459d89adfd004083a748f81a0391 |
|
13-Jul-2010 |
Gilles Debunne <debunne@google.com> |
Cosmetic changes around TextView. Fixed some warnings in the code. Change-Id: Id19395031a1ab41edcc47e3dc8cd9479c6e19f83
/frameworks/base/core/java/android/text/Selection.java
|
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 |
|
04-Mar-2009 |
The Android Open Source Project <initial-contribution@android.com> |
auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/text/Selection.java
|
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 |
|
04-Mar-2009 |
The Android Open Source Project <initial-contribution@android.com> |
auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/text/Selection.java
|
d24b8183b93e781080b2c16c487e60d51c12da31 |
|
11-Feb-2009 |
The Android Open Source Project <initial-contribution@android.com> |
auto import from //branches/cupcake/...@130745
/frameworks/base/core/java/android/text/Selection.java
|
f013e1afd1e68af5e3b868c26a653bbfb39538f8 |
|
18-Dec-2008 |
The Android Open Source Project <initial-contribution@android.com> |
Code drop from //branches/cupcake/...@124589
/frameworks/base/core/java/android/text/Selection.java
|
54b6cfa9a9e5b861a9930af873580d6dc20f773c |
|
21-Oct-2008 |
The Android Open Source Project <initial-contribution@android.com> |
Initial Contribution
/frameworks/base/core/java/android/text/Selection.java
|