Skip to content

fix(desktop): keep composer caret aligned with mixed-script text - #686

Merged
huichen merged 1 commit into
mainfrom
fix/composer-caret
Sep 17, 2026
Merged

huichen merged 1 commit into
mainfrom
fix/composer-caret

Conversation

@huichen

@huichen huichen commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Override inherited optimizeLegibility with optimizeSpeed only on the editable composer, leaving message typography and IME/selection logic unchanged.
  • Add a regression guard for the scoped style override.

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

  • npx tsc --noEmit
  • npx eslint "src/**/*.{ts,tsx}"
  • npx vitest run: 133 files, 1120 tests passed
  • Native WKWebView geometry checks above (jsdom cannot validate glyph/caret geometry)

@huichen
huichen enabled auto-merge (squash) September 17, 2026 03:59
@huichen
huichen merged commit 5220ff6 into main Sep 17, 2026
12 checks passed
@huichen
huichen deleted the fix/composer-caret branch September 17, 2026 04:02
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.

1 participant