File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -224,7 +224,10 @@ void MacosInputContext::commitStringImpl(const std::string &text) {
224224 // committed in next commit with a key event. e.g. fcitx commits a ,
225225 // asynchronously when deleting , after a number/English character.
226226 if (!isSyncEvent) {
227- commitAndSetPreeditAsync ();
227+ // When changing this, test Messages.app by clicking a candidate.
228+ // Previously buggy behavior is that preedit is appended after commit.
229+ SwiftFrontend::commitAsync (client_, state_.commit );
230+ resetState ();
228231 }
229232}
230233
Original file line number Diff line number Diff line change @@ -70,6 +70,16 @@ public func commitAndSetPreeditAsync(
7070 }
7171}
7272
73+ public func commitAsync( _ clientPtr: UnsafeMutableRawPointer , _ commit: String ) {
74+ let client : AnyObject = Unmanaged . fromOpaque ( clientPtr) . takeUnretainedValue ( )
75+ guard let client = client as? IMKTextInput else {
76+ return
77+ }
78+ DispatchQueue . main. async {
79+ commitString ( client, commit)
80+ }
81+ }
82+
7383public func getCursorCoordinates(
7484 _ clientPtr: UnsafeMutableRawPointer ,
7585 _ followCursor: Bool ,
You can’t perform that action at this time.
0 commit comments