Repository navigation
Conversation
Contributor
Author
|
. |
Contributor
Author
|
Now you can test it, as back then was failed build, but now is all good |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Delete swipe: visual lines via
requestTextBoundsInfo(Android 14+), opt-in, falls back to the current estimateBased on
mainat version 4.2.9, with the previous estimate (about 40 characters, split at whitespace) restored as the fallback. Independent of PR #702: noDPAD_UP, no key events, nogetExtractedText(),no batch edit, no parallel "shadow" selection. Offered as an alternative for the maintainer to look at, not a request.
Fallback: previous estimate restored
4.2.9 replaced the estimate in
getLineBoundariesBackwardswithfindSegmentBreaksBackwards(sentence/clause punctuation only),which selects the whole paragraph on the first vertical step when the text has no
. ! ? … : ;. This change puts thepre-4.2.9
getLineBoundariesBackwardsback (identical to the earlier version), removesfindSegmentBreaksBackwards, andremoves the two tests that were added for the punctuation behaviour in
WordDeleteSwipeTest.kt(
long line with newline exceeding 50 chars remains intact,multi sentence paragraph without newline splits at sentence boundaries).The file then matches the earlier version again. If you prefer to keep the 4.2.9 estimate, drop those parts of the patch;
the
requestTextBoundsInfopart doesn't depend on them.Idea
Instead of probing the editor by moving its caret, ask it where its lines break. Android 14 added
InputConnection.requestTextBoundsInfo(RectF, Executor, Consumer): the editor answers asynchronously withthe bounds of its characters. The swipe turns that into line starts and uses them in place of
getLineBoundariesBackwards()(the 40-character estimate). Everything else (char/word offsets, right-swipe deselect,setSelection, release) is unchanged.How it differs from the concerns raised on #702
DPAD_UPsetSelectioncalls as today. No second selection record.Behaviour
delete_swipe_exact_lines, default off), next to the other delete swipe options. It is only shown on Android 14+ (the setting does nothing below that).CursorAnchorInfo(the keyboard already callsrequestCursorUpdates(MONITOR | IMMEDIATE);LatinIMEnow keeps the latest one).SegmentFinderoffsets.Files
KeyboardActionListenerImpl.kt: request/hold/apply logic, conversion ofTextBoundsInfo; previous estimate restored.latin/utils/VisualLines.kt(new): pure functionslineStartsandbuildBoundaries(no Android classes).RichInputConnection.kt:requestTextBoundsInfo()wrapper (@RequiresApi(34)),lastCursorAnchorInfo.LatinIME.kt:onUpdateCursorAnchorInfostores the latest info.Settings.kt,Defaults.kt,SettingsValues.kt,GestureTypingScreen.kt,res/values/strings.xml: the setting (English only).VisualLinesTest.kt(new): 8 unit tests for the pure functions.WordDeleteSwipeTest.kt: the two tests for the punctuation estimate removed.leantype-textboundsinfo.patchis the same change (restore of the previous estimate +requestTextBoundsInfo) as one unified diff against 4.2.9;app/holds the full changed files.Limits
onRequestTextBoundsInfo. NativeEditText/TextViewshould; I don't know about WebView/Chrome, Termux, Compose fields or custom editors. Where it isn't supported the behaviour is the current estimate.CursorAnchorInfo; if the editor scrolled without sending a new one, the requested area can be off and the result falls back / continues with the estimate.main: each step goes to the start of a line (not "same column on the line above").Not verified
Not compiled and not run (no Android toolchain available to me). The
TextBoundsInfo/TextBoundsInfoResultcalls(
getCharacterBounds,getCharacterFlags,FLAG_CHARACTER_LINEFEED,requestTextBoundsInfosignature) are written from myknowledge of the API and need a compile check. The pure logic was only checked by hand against the unit tests' expectations.
Suggested manual test (setting on, Android 14+): native EditText with soft-wrapped text, up/up/down/down, up then left/right,
word-by-word mode, release deletes exactly the highlighted text, single-line field, top of the text, an app that doesn't
support the request (must feel like before), and the setting off (must behave like before).