summaryrefslogtreecommitdiff
path: root/core/java/android/text/Selection.java
Commit message (Collapse)AuthorAgeFilesLines
* Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-071-1/+1
| | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-151-0/+3
| | | | | | | | | | | | | | | | | | | | For packages: android.text.util android.text.style android.text.method android.text.format android.text This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I9afbd4ca8826c37cb70db43252e39b9a674e5ae0
* Fix crash when modifying SelectionClara Bayarri2018-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Make up/down movement of multilength lines remember positionClara Bayarri2017-07-181-55/+128
| | | | | | Test: Separate CTS CL being submitted along this one, see topic Bug: 25486843 Change-Id: I463c126b07db05b1c4a26e870cde5c5567471da0
* Up/down arrow moves to beginning/end of bufferRaph Levien2014-09-041-2/+11
| | | | | | | | | | 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
* Extracted WordIterator class.Gilles Debunne2011-04-201-3/+0
| | | | | | | | | | | 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
* Support Ctrl-based EditText movement.Jeff Sharkey2011-03-211-4/+45
| | | | | | | | | 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
* Cosmetic changes around TextView.Gilles Debunne2010-07-131-2/+2
| | | | | | Fixed some warnings in the code. Change-Id: Id19395031a1ab41edcc47e3dc8cd9479c6e19f83
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+429
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-429/+0
|
* auto import from //branches/cupcake/...@130745The Android Open Source Project2009-02-101-3/+3
|
* Code drop from //branches/cupcake/...@124589The Android Open Source Project2008-12-171-2/+5
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+426