macos: key input that clears preedit without text shouldn't encode

Fixes #7225
This commit is contained in:
Mitchell Hashimoto 2025-04-28 14:00:35 -07:00
parent 7daabdddef
commit e5e89bcbe4
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC

View File

@ -975,7 +975,14 @@ extension Ghostty {
event: event,
translationEvent: translationEvent,
text: translationEvent.ghosttyCharacters,
composing: markedText.length > 0
// We're composing if we have preedit (the obvious case). But we're also
// composing if we don't have preedit and we had marked text before,
// because this input probably just reset the preedit state. It shouldn't
// be encoded. Example: Japanese begin composing, the press backspace.
// This should only cancel the composing state but not actually delete
// the prior input characters (prior to the composing).
composing: markedText.length > 0 || markedTextBefore
)
}
}