Repository navigation
fix(desktop): keep composer caret aligned with mixed-script text - #686
Merged
Merged
Conversation
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.
Summary
Root cause and native verification
Reproduced in a visible macOS WKWebView loading the real MentionEditor component and application CSS from Vite. Type Chinese text, Shift+Enter (including an empty line), then 在desktop. The trailing ZWSP used to keep the final line editable triggers incorrect mixed-script caret measurement on the inherited shaping path.
Before: final text edge x=123.165, caret x=118 (5.165 CSS px overlap).
After: final text edge x=123.268, caret x=123 (normal subpixel rounding).
Also checked plain English, Chinese, mixed letters/digits, repeated newlines, and soft wrapping; all end-caret deltas stayed below 1 CSS px. text-rendering:auto and disabling kerning/ligatures alone did not fix the reproducer. Native validation used an isolated WKWebView component harness, not the full Tauri application; no running agent was disturbed.
Tests