Fix Paragraph.getOffsetForPosition behavour in corner cases#3071
Open
Vladimir Mazunin (mazunin-v-jb) wants to merge 1 commit into
Open
Fix Paragraph.getOffsetForPosition behavour in corner cases#3071Vladimir Mazunin (mazunin-v-jb) wants to merge 1 commit into
Paragraph.getOffsetForPosition behavour in corner cases#3071Vladimir Mazunin (mazunin-v-jb) wants to merge 1 commit into
Conversation
Author
|
Just in case, it's better to merge it after this PR. |
|
|
||
| // For RTL blocks, the position is still not correct, so we have to subtract 1 from the returned result | ||
| if (!isNeutralChar && getBoxBackwardByOffset(correctedGlyphPosition)?.direction == Direction.RTL) { | ||
| correctedGlyphPosition -= 1 // TODO Check if it should be CodePoint.charCount() |
Collaborator
There was a problem hiding this comment.
It's an implementation of a common interface, and most likely some commonMain code relies on that.
Just saying that we do it differently and fixing copy-pasted tests (that should be in commonTest ideally) seems really suspicious tbh.
Shouldn't we align SkParagraph to android instead?
…kiaParagraph, removed @Ingore related to CMP-8594, adjusted Skia test to match android behavior
d107e97 to
cd41693
Compare
Paragraph.getOffsetForPosition behavour in corner cases
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.
Follow-up to the Skia/Skiko hit-testing fixes for caret positioning.
This PR must be merged after updating Skia.
getOffsetForPosition(thecorrectedGlyphPosition -= 1branch with theisNeutralDirection/Direction.RTLcheck). Skia should return the correct offset for clicks to the right of a line in mixed-direction text now, so the compose-side adjustment is no longer needed.→getOffsetForPosition_midpointOfComplexCharacter_snapsToClusterStart`, since it's more accurate and conforms to the Android behavior.Fixes:
CMP-8594 Fix
Paragraph.getOffsetForPositionbehavour in corner casesTesting
There are tests already, however, this better be tested by QA
Release Notes
N/A