Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7596228

Browse files
committed
Safari: fix incorrect cursor position after smart quote insertion
Safari 26 positions the cursor incorrectly after smart quotes textsubstitution, causing it to jump back 1-2 characters.After insertReplacementText events, the cursor is incorrectlypositioned. Trix's selectionDidChange handler syncs, corrupting itsinternal state.Hack to work around it:* Detect whether replacement is "at cursor" (smart quotes) vs "before cursor" (autocorrect) with <= 2 char distance heuristic.* For at-cursor replacements: manually calculate correct positioning accounting for length diff and triggering character (+1); set cursor in Trix; skip 3 input events to prevent corrupt sync; prevent selectionDidChange from syncing in the meantime; restore cursor position in requestAnimationFrame (no visible cursor movement).To reproduce the issue: enable Edit > Substitutions > Smart Quotes inSafari, hit Enter twice then "I'll " - including the final space. Thecursor should remain after the final space, no after the replacedapostrophe. Similarly with autocorrect: the cursor should not move tothe end of the spelling-corrected word.
1 parentb307451 commit7596228

File tree

4 files changed

+2149
-1963
lines changed

4 files changed

+2149
-1963
lines changed

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp