macos: route IME preedit commits through key events (#13222)

This commit is contained in:
Lukas
2026-07-08 07:06:44 +02:00
committed by GitHub

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)
}