InputHandler // Fix several issues with Pinyin handling.

- Stop committing unfinished pinyin.
- Detect isReadingKeyNotEmpty for Tekkon RomajiBuffer.
This commit is contained in:
ShikiSuen 2023-05-01 20:25:50 +08:00
parent 9190e13aeb
commit 2c3bd26b73
2 changed files with 6 additions and 2 deletions

View File

@ -86,7 +86,11 @@ extension InputHandler {
// 使 composer.value.isEmpty composer 調
composeReading = composeReading || (!composer.isEmpty && confirmCombination)
// readingKey
composeReading = composeReading && !readingKey.isEmpty
var isReadingKeyNotEmpty = !readingKey.isEmpty
if isComposerUsingPinyin {
isReadingKeyNotEmpty = isReadingKeyNotEmpty || !composer.romajiBuffer.isEmpty
}
composeReading = composeReading && isReadingKeyNotEmpty
if composeReading {
if input.isControlHold, input.isCommandHold, input.isEnter,
!input.isOptionHold, !input.isShiftHold, compositor.isEmpty

View File

@ -207,7 +207,7 @@ extension InputHandler {
delegate.switchState(inputting)
} else {
let displayedText = state.displayedText
if !displayedText.isEmpty {
if !displayedText.isEmpty, !isConsideredEmptyForNow {
delegate.switchState(IMEState.ofCommitting(textToCommit: displayedText))
}
delegate.switchState(IMEState.ofCommitting(textToCommit: " "))