Repository navigation
Conversation
…ey press Apple Korean answers the key that starts a new syllable with insertText of the finished syllable (a replacement, so a commit) and then insertText of the key's own jamo. That second text matched the key's characters, so it was left to the key's KeyboardInput, which keyDown doesn't send once the key committed text (W9). The jamo was lost and the next replacement deleted the syllable before it: "안녕하세요" typed "녕하세요". The key's text is committed when a commit already went out during the key press. Guarded by tests/ime_patches.rs.
b1001e4 to
50d34a3
Compare
FredApps
left a comment
There was a problem hiding this comment.
ReviewerA — source-read COMMENT (not an approval)
I read the hunk: in the macOS insertText handler, the plain-key-text branch is skipped when a commit was already sent during the same key press (committed_in_key_down), because keyDown: doesn't send that key's KeyboardInput after a commit, and Apple Korean IME commits the syllable and then inserts the next jamo, which was dropped. The condition is a narrow, well-commented guard. I can't run an IME here; please include a test with the Korean sequence in the description, and confirm the skipped branch's delete of the replaced range doesn't also have to happen when the jamo is committed on the other path.
I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.
Status: waiting_author.
Problem
Typing Korean with Apple 2-Set Korean loses the syllable before each new one:
안녕하세요comes out as녕하세요(GridCraft, macOS 27, real keyboard; the in-cell editor and the formula bar alike).On this setup Apple Korean doesn't use marked text with the winit view. For the key that starts a new syllable it calls:
insertText("안", replacementRange): the finished syllable, a replacement. Committed (Ime::Commit+take_ime_delete_surrounding), socommitted_in_key_down = true.insertText("ㄴ", NSNotFound): the key's own jamo, equal to the key's characters, soplain_insertreturnsKeyText. It goes intoImeDocumentand is left to the key'sKeyboardInput.keyDown:doesn't send thatKeyboardInput, because the key committed text (W9,committed_in_key_down). The app never getsㄴ. The next key replacesㄴwith녀(delete 3 bytes + commit), and those 3 bytes are안in the app.Events the app received for
d k s s u d(안녕), before the fix:Fix
KeyTextis committed likeCommitwhen a commit already went out during the key press, since noKeyboardInputwill carry it. After the fix the third line isDeleteSurroundingBytes(3) Commit("안") Commit("ㄴ")and안녕하세요is typed correctly.src/platform_impl/macos/view.rs: theKeyTextarm is guarded by!committed_in_key_down; otherwise it takes the commit arm.tests/ime_patches.rs:macos_jamo_typed_after_a_commit_is_committed(fails without the fix).PATCHES.md: W28.Verification
cargo test --test ime_patches: 45 passed (the new guard fails without the change).cargo clippy --lib --tests: clean.cargo +nightly fmtapplied.안녕하세요typed over a cell and in the in-cell editor after F2 is entered whole. Synthetic key codes (g k s r m f) give한글(was글).Related
storytold/gridcraft#2735 fixes the other half, in GridCraft (the start of a cell split the first syllable). Once this merges, GridCraft's
[patch]rev for winit needs a bump.