@@ -6,6 +6,16 @@ private var currentPreedit = ""
66
77private let zeroWidthSpace = " \u{200B} "
88
9+ // Given issues when no preedit is so widespread regardless of UI framework,
10+ // any app that is added here must be fully tested with Esc, Backspace, Arrow and normal keys.
11+ private let appsWithoutDummyPreedit : Set < String > = [
12+ // <200b>
13+ " org.vim.MacVim " ,
14+ // When writing a new email and caret is at the beginning of To or Cc, Mail calls commitComposition
15+ // if the preedit is any kind of white space.
16+ " com.apple.mail " ,
17+ ]
18+
919private var controller : IMKInputController ? = nil
1020
1121public func setController( _ ctrl: Any ) {
@@ -63,17 +73,16 @@ public func commitAndSetPreeditSync(
6373 if !commit. isEmpty {
6474 commitString ( client, commit)
6575 }
66- // Without client preedit, Backspace bypasses IM in Terminal, every key
67- // is both processed by IM and passed to client in iTerm, so we force a
68- // dummy client preedit here.
76+ // Without client preedit, Backspace bypasses IM in Terminal, every key is both
77+ // processed by IM and passed to client in iTerm and VSCode terminal, Backspace
78+ // is double-processed in Chrome address bar/VSCode editor/Bruno URL input, ArrowDown
79+ // is swallowed in Spotlight, so we force a dummy client preedit here.
6980 // Some apps also need it to get accurate caret position to place candidate window.
7081 // This is fine even when there is selected text. In Word, not using dummy preedit to
7182 // replace selected text will let Esc bypass IM. When using Shift+click to select, if
7283 // interval is too little, IM switch happens, but dummyPreedit is false in that case.
7384 if preedit. isEmpty && dummyPreedit {
74- if client. bundleIdentifier ( ) == " com.apple.mail " {
75- // When writing a new email and caret is at the beginning of To or Cc, Mail calls commitComposition
76- // if the preedit is any kind of white space. But hey it doesn't need dummy preedit at all.
85+ if appsWithoutDummyPreedit. contains ( client. bundleIdentifier ( ) ?? " " ) {
7786 return
7887 }
7988 let length = client. length ( )
0 commit comments