Repository navigation
Conversation
Fix space being inserted twice. Fix ASCII characters being dropped when typed during preedit state.
hiking90
added a commit
to hiking90/winit
that referenced
this pull request
Feb 22, 2026
Fix space being inserted twice. Fix ASCII characters being dropped when typed during preedit state. Cherry-picked from: rust-windowing#4478 Co-Authored-By: Jay Choi <jayyoungchoi22@gmail.com>
zilhak
added a commit
to zilhak/winit-ime-fix
that referenced
this pull request
Apr 1, 2026
Port of rust-windowing#4478 to v0.30.13. Bug 1 - Space double input: Clear marked_text immediately after commit to prevent subsequent insertText calls from being treated as IME commits. Bug 2 - Trigger key drop (comma, period, etc.): Remove the early return guard in doCommandBySelector when ImeState::Committed, which was swallowing ASCII key commands after IME commit. When upstream PR rust-windowing#4478 is merged and released, this fork should be replaced with the official winit release. Reference: rust-windowing#4478
zilhak
added a commit
to zilhak/tasty
that referenced
this pull request
Apr 1, 2026
winit의 macOS 백엔드 버그로 인해 한글 컴포징 후 트리거 키(콤마, 마침표 등)의 Pressed 이벤트가 누락되고, 스페이스가 이중 입력되던 문제를 애플리케이션 레벨 workaround로 처리하고 있었음. winit PR #4478의 수정을 v0.30.13에 포팅한 fork를 사용하여 근본 원인을 해결하고, 기존 ime_committed_text 기반 workaround 코드를 전부 제거. Fork: https://github.com/zilhak/winit-ime-fix (branch: fix-korean-ime) Upstream PR: rust-windowing/winit#4478
3 of 5 tasks
This was referenced Jul 30, 2026
minhyeoky
pushed a commit
to minhyeoky/alacritty
that referenced
this pull request
Sep 27, 2026
With the built-in Korean IME and no active composition (e.g. right after punctuation or backspace), one Space press reached the terminal twice: once as an IME commit and once as a key event. Patch the vendored winit 0.30.13 with the fix from rust-windowing/winit#4478: - insertText: clear marked text on commit so later insertText calls in the same interpretKeyEvents pass don't see stale preedit; forward a post-commit insertText as a regular key event. - doCommandBySelector: drop the early return on the Committed state, which swallowed keys right after a commit. Wire it in through [patch.crates-io] and keep vendor/ out of the workspace. Refs alacritty#8079 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QGGbnFKGxfaz4n6TzPrQ2F
IrosTheBeggar
added a commit
to IrosTheBeggar/mstream-terminal-player
that referenced
this pull request
Oct 1, 2026
…ME backport Two crates the window stands on need patches upstream has not released: ratatui-wgpu 0.6.0 (surface format, face index, wide-glyph shaping, failed presents — the next lane's work) and winit 0.30.13 (macOS drops an ASCII key typed right after an input method's commit and doubles a Space typed with no composition; rust-windowing/winit#4478, open against master). Both now live under vendor/ through [patch.crates-io], examples and test assets trimmed, each with a VENDORED.md naming the version and every change. The winit backport is applied to src/platform_impl/macos/ view.rs, hunk for hunk against the upstream diff. What the lane also settled: the Japanese "swallowed first Enter" was never a winit defect. A plain AppKit text view, fed the same posted keys, behaves identically — after Space opens Kotoeri's candidate list the first Enter closes it and the second commits; without Space one Enter commits — and stock winit matches the backport. The record, the checklist and the Windows brief say so now. Korean, the backport's real target, is untested here (no Korean source enabled). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
echelon
added a commit
to storytold/pdfcraft
that referenced
this pull request
Oct 10, 2026
…pace (winit#4478) (#679) * macOS: IME text committed after the marked text is cleared isn't lost (winit#4650) winit 0.30.13 reports insertText as Ime::Commit only while marked text is left, and after any commit it swallows the next key. Real paths where that loses text: - input methods that end a composition with unmarkText, then insertText (rust-windowing/winit#3925): the committed text was dropped; - Apple Korean 2-Set, for the key typed after a syllable: on 한 then 5 it calls setMarkedText("한"), insertText("한"), setMarkedText(""), insertText("5"), so the 5 (or ;, or any key that ends the syllable) was dropped; - a commit made outside a key press (a candidate clicked with the mouse, dictation): no key follows to reset the state, so the next key (for example Backspace) was swallowed. vendor/winit now commits when a composition was started (pending_commit, set in setMarkedText, cleared by the commit and when IME is disallowed); other insertText calls still reach the app as KeyboardInput. A commit outside keyDown clears the marked text and returns to the ground state. validAttributesForMarkedText lists the underline and marked-clause attributes, which some input methods need before they compose. This is rust-windowing/winit#4650, the 0.30 backport of #4651 (merged on winit master), plus the part of #4748 that fixes #4651's out-of-key-press case (#4748's other parts are not included). One correction: upstream spells the underline attribute "NSUnderlineStyle", but AppKit's NSUnderlineStyleAttributeName is "NSUnderline" (printed on macOS 14), so the AppKit value is used. Checked with the real input methods on macOS 14.7.1 (a scratch winit app fed key events through AppKit): with the patch 한+5 and 한+; commit the 5 and ;, unmarkText-then-insertText commits, and Backspace after a commit outside a key press is delivered; ABC typing, held keys, Japanese (日本, あ), Cangjie (日) and Korean composition give the same events as before. A test fails if a re-vendored winit loses the patch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * macOS: Space in Apple Korean with no syllable in progress types one space (winit#4478) With Apple Korean 2-Set on macOS 14, Space with no syllable in progress (a second space, or a space after a digit or punctuation) makes AppKit call setMarkedText(" "), insertText(" "), then setMarkedText(""). winit reports the insertText as Ime::Commit(" "), but the trailing empty setMarkedText returns its state to the ground state, so keyDown also sends the key as KeyboardInput with text " ". egui inserts both, and PdfCraft's text fields got two spaces (the double space of alacritty/alacritty#8079). vendor/winit now records that the key being handled committed IME text and then doesn't also send it as KeyboardInput, unless AppKit forwards it as a command through doCommandBySelector (Enter after a syllable still commits the syllable and sends Enter). keyDown consumes the record on every key, so keys typed after IME is disallowed are unaffected. rust-windowing/winit#4478 aims at the same double space, but its changes (clearing the marked text on commit, forwarding a later insertText, and dropping doCommandBySelector's guard) don't reach this call order, and the key loss it also fixes is already fixed by the previous change (pending_commit). This is the narrow form for the call order observed here; it should go upstream with #4478. Checked with the real input methods on macOS 14.7.1 (scratch winit app, on top of the previous change): the duplicate KeyboardInput Space is gone and nothing else changes (Korean syllables, 한+Enter, 한+5, Japanese, Cangjie, ABC, held keys, keys after IME is disallowed). A test fails if a re-vendored winit loses the patch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep #678's emoji-picker branch: view.rs is main's plus this PR's Space fix (54b3d3c) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>
krichelj
pushed a commit
to krichelj/pdfcraft
that referenced
this pull request
Oct 11, 2026
…pace (winit#4478) (storytold#679) * macOS: IME text committed after the marked text is cleared isn't lost (winit#4650) winit 0.30.13 reports insertText as Ime::Commit only while marked text is left, and after any commit it swallows the next key. Real paths where that loses text: - input methods that end a composition with unmarkText, then insertText (rust-windowing/winit#3925): the committed text was dropped; - Apple Korean 2-Set, for the key typed after a syllable: on 한 then 5 it calls setMarkedText("한"), insertText("한"), setMarkedText(""), insertText("5"), so the 5 (or ;, or any key that ends the syllable) was dropped; - a commit made outside a key press (a candidate clicked with the mouse, dictation): no key follows to reset the state, so the next key (for example Backspace) was swallowed. vendor/winit now commits when a composition was started (pending_commit, set in setMarkedText, cleared by the commit and when IME is disallowed); other insertText calls still reach the app as KeyboardInput. A commit outside keyDown clears the marked text and returns to the ground state. validAttributesForMarkedText lists the underline and marked-clause attributes, which some input methods need before they compose. This is rust-windowing/winit#4650, the 0.30 backport of storytold#4651 (merged on winit master), plus the part of storytold#4748 that fixes storytold#4651's out-of-key-press case (storytold#4748's other parts are not included). One correction: upstream spells the underline attribute "NSUnderlineStyle", but AppKit's NSUnderlineStyleAttributeName is "NSUnderline" (printed on macOS 14), so the AppKit value is used. Checked with the real input methods on macOS 14.7.1 (a scratch winit app fed key events through AppKit): with the patch 한+5 and 한+; commit the 5 and ;, unmarkText-then-insertText commits, and Backspace after a commit outside a key press is delivered; ABC typing, held keys, Japanese (日本, あ), Cangjie (日) and Korean composition give the same events as before. A test fails if a re-vendored winit loses the patch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * macOS: Space in Apple Korean with no syllable in progress types one space (winit#4478) With Apple Korean 2-Set on macOS 14, Space with no syllable in progress (a second space, or a space after a digit or punctuation) makes AppKit call setMarkedText(" "), insertText(" "), then setMarkedText(""). winit reports the insertText as Ime::Commit(" "), but the trailing empty setMarkedText returns its state to the ground state, so keyDown also sends the key as KeyboardInput with text " ". egui inserts both, and PdfCraft's text fields got two spaces (the double space of alacritty/alacritty#8079). vendor/winit now records that the key being handled committed IME text and then doesn't also send it as KeyboardInput, unless AppKit forwards it as a command through doCommandBySelector (Enter after a syllable still commits the syllable and sends Enter). keyDown consumes the record on every key, so keys typed after IME is disallowed are unaffected. rust-windowing/winit#4478 aims at the same double space, but its changes (clearing the marked text on commit, forwarding a later insertText, and dropping doCommandBySelector's guard) don't reach this call order, and the key loss it also fixes is already fixed by the previous change (pending_commit). This is the narrow form for the call order observed here; it should go upstream with storytold#4478. Checked with the real input methods on macOS 14.7.1 (scratch winit app, on top of the previous change): the duplicate KeyboardInput Space is gone and nothing else changes (Korean syllables, 한+Enter, 한+5, Japanese, Cangjie, ABC, held keys, keys after IME is disallowed). A test fails if a re-vendored winit loses the patch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep storytold#678's emoji-picker branch: view.rs is main's plus this PR's Space fix (54b3d3c) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>
This was referenced Oct 12, 2026
richerfu
pushed a commit
to richerfu/winit
that referenced
this pull request
Nov 2, 2026
Related to rust-windowing#4478; PdfCraft patch, to be proposed upstream. Originally "M15.1: suppress duplicate macOS Korean spaces" in storytold/wordcraft#787 (same change as storytold/pdfcraft vendor/winit).
This branch has not been deployed
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.
changelogmodule if knowledge of this change could be valuable to usersSummary
A minimal fix that addresses a major pain point in macOS Korean IME handling.
Fixes two interrelated bugs reported downstream in Alacritty:
Spaceonce inserts two spacesWhen using CJK input method in MacOS, space is inserted twice per 1 stroke. alacritty/alacritty#8079
Keyboard input does not work with CJK IME (macOS, 0.12.1) alacritty/alacritty#6942
Root Cause
Bug 1: Double Space
When Space is pressed with Korean IME active but no active composition, macOS calls
setMarkedText(" ")followed byinsertTexttwice within the sameinterpretKeyEvents. The firstinsertTextcall setImeState::Committedbut did not clearmarked_text. The second call still sawhasMarkedText() == trueand emitted a duplicateIme::Commit(" ").Bug 2: Key Loss
doCommandBySelectorhad a blanket early-return guard whenImeState == Committed:This was originally added to prevent
Enterfrom being sent twice when used to confirm IME input. However, it was too aggressive — it swallowed ASCII key commands after a commit, preventingforward_key_to_appfrom being set. This caused trigger keys to be silently dropped.Fix
In
insertText:marked_textimmediately after committing, so subsequentinsertTextcalls within the sameinterpretKeyEventsno longer see stale preedit state.else if Committedbranch that setsforward_key_to_app = truefor post-commit characters, forwarding them as regular key events instead of duplicate IME commits.In
doCommandBySelector:Committedearly-return guard. Withmarked_textproperly cleared ininsertText, the double-input issue this guard was meant to prevent no longer occurs.Test Results (Korean IME)
Tested with the
imeexample (cargo run --example ime). Below are before/after comparisons for each Korean IME scenario.Space on empty field (Bug 1: double space)
"한" + Space commit (already worked)
"한" + Enter commit (already worked)
"한" + digit (Bug 2: key loss)
"한" + ASCII (Bug 2: key loss)
Impact on Other CJK IMEs
These changes only affect the Korean IME code path. Japanese and Chinese IMEs are not affected because:
doCommandBySelectoror trigger a secondinsertTextwithin the sameinterpretKeyEventscall.Committedstate is reset toGroundat the end of eachkeyDown, so the next keypress always starts fromGroundregardless of IME.Japanese and Chinese IMEs were tested and confirmed no regression (nihon→にほん, nihao→你好, emoji selection, etc.).