mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-10 11:19:45 +00:00
macos: route IME preedit commits through key events
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user