Skip to content

Removed caret snapping inside grapheme clusters hack#3049

Merged
Vladimir Mazunin (mazunin-v-jb) merged 7 commits into
jb-mainfrom
v.mazunin/move-caret-adjustments-for-complex-glyphs-to-skia
Jun 18, 2026
Merged

Removed caret snapping inside grapheme clusters hack#3049
Vladimir Mazunin (mazunin-v-jb) merged 7 commits into
jb-mainfrom
v.mazunin/move-caret-adjustments-for-complex-glyphs-to-skia

Conversation

@mazunin-v-jb

Copy link
Copy Markdown

… because of moving this logic to our Skia fork

This should be merged after merging this PR to Skia, and merging updated Skia to the compose-multiplatform-core.

Technically, this is a revert of this PR excluding the tests.

Fixes:
CMP-8324 Move caret adjustments in complex glyphs fix to Skia

Testing

Autotests:
SkikoParagraphTest.getOffsetForPosition_insideComplexCharacter_shouldJumpToEnd
SkikoParagraphTest.getOffsetForPosition_endOfLineWithComplexCharacter_shouldPositionCorrectly

This should be tested by QA.
Test case is here

Release Notes

N/A

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I assume the tests will pass with the new skia/skiko.

@MatkovIvan Ivan Matkov (MatkovIvan) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but requires updating skia + make CI green first

@mazunin-v-jb

Copy link
Copy Markdown
Author

PR in skia is merged, waiting for the Skia merged here

@mazunin-v-jb Vladimir Mazunin (mazunin-v-jb) force-pushed the v.mazunin/move-caret-adjustments-for-complex-glyphs-to-skia branch from 4bb6028 to 3861d53 Compare June 16, 2026 12:55
Follow-up to [the Skia/Skiko hit-testing fixes for caret positioning.
](JetBrains/skia#20)
This PR must be merged after updating Skia.

- Enabled three previously ignored tests.
- Removed the workaround with the RTL block-position correction in
`getOffsetForPosition` (the `correctedGlyphPosition -= 1` branch with
the `isNeutralDirection` / `Direction.RTL` check). 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.
- Adjusted and removed
getOffsetForPosition_insideComplexCharacter_shouldJumpToEnd` →
`getOffsetForPosition_midpointOfComplexCharacter_snapsToClusterStart`,
since it's more accurate and conforms to the Android behavior.

Fixes:
[CMP-8594 Fix `Paragraph.getOffsetForPosition` behavour in corner
cases](https://youtrack.jetbrains.com/issue/CMP-8594)


## Testing
There are tests already, however, this better be tested by QA

## Release Notes
N/A
@mazunin-v-jb

Vladimir Mazunin (mazunin-v-jb) commented Jun 16, 2026

Copy link
Copy Markdown
Author

Hubert Błaszczyk (@hub-bla), jfyi I've updated skiko to 0.149.0 here to keep CI green on jb-man.
Sorry, mistaken versions, using 0.148.3 here

Comment thread gradle/libs.versions.toml Outdated
@mazunin-v-jb Vladimir Mazunin (mazunin-v-jb) merged commit da5e94d into jb-main Jun 18, 2026
30 of 31 checks passed
@mazunin-v-jb Vladimir Mazunin (mazunin-v-jb) deleted the v.mazunin/move-caret-adjustments-for-complex-glyphs-to-skia branch June 18, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants