macos: route IME preedit commits through key events

This commit is contained in:
qappell
2026-07-07 13:00:39 -05:00
parent 2da015cd6a
commit 751a60df61

View File

@@ -2042,6 +2042,8 @@ extension Ghostty.SurfaceView: NSTextInputClient {
return
}
let hadMarkedText = hasMarkedText()
// If insertText is called, our preedit must be over.
unmarkText()
@@ -2053,6 +2055,13 @@ extension Ghostty.SurfaceView: NSTextInputClient {
return
}
if hadMarkedText, !chars.isEmpty {
// Send preedit commits as key events instead of raw text for
// keybind interpretation by programs.
_ = committedPreeditTextAction(GHOSTTY_ACTION_PRESS, text: chars)
return
}
surfaceModel.sendText(chars)
}