InputHandler // Fix several issues with Pinyin handling.
- Stop committing unfinished pinyin. - Detect isReadingKeyNotEmpty for Tekkon RomajiBuffer.
This commit is contained in:
parent
9190e13aeb
commit
2c3bd26b73
|
@ -86,7 +86,11 @@ extension InputHandler {
|
||||||
// 這裡必須使用 composer.value.isEmpty,因為只有這樣才能真正檢測 composer 是否已經有陰平聲調了。
|
// 這裡必須使用 composer.value.isEmpty,因為只有這樣才能真正檢測 composer 是否已經有陰平聲調了。
|
||||||
composeReading = composeReading || (!composer.isEmpty && confirmCombination)
|
composeReading = composeReading || (!composer.isEmpty && confirmCombination)
|
||||||
// readingKey 不能為空。
|
// readingKey 不能為空。
|
||||||
composeReading = composeReading && !readingKey.isEmpty
|
var isReadingKeyNotEmpty = !readingKey.isEmpty
|
||||||
|
if isComposerUsingPinyin {
|
||||||
|
isReadingKeyNotEmpty = isReadingKeyNotEmpty || !composer.romajiBuffer.isEmpty
|
||||||
|
}
|
||||||
|
composeReading = composeReading && isReadingKeyNotEmpty
|
||||||
if composeReading {
|
if composeReading {
|
||||||
if input.isControlHold, input.isCommandHold, input.isEnter,
|
if input.isControlHold, input.isCommandHold, input.isEnter,
|
||||||
!input.isOptionHold, !input.isShiftHold, compositor.isEmpty
|
!input.isOptionHold, !input.isShiftHold, compositor.isEmpty
|
||||||
|
|
|
@ -207,7 +207,7 @@ extension InputHandler {
|
||||||
delegate.switchState(inputting)
|
delegate.switchState(inputting)
|
||||||
} else {
|
} else {
|
||||||
let displayedText = state.displayedText
|
let displayedText = state.displayedText
|
||||||
if !displayedText.isEmpty {
|
if !displayedText.isEmpty, !isConsideredEmptyForNow {
|
||||||
delegate.switchState(IMEState.ofCommitting(textToCommit: displayedText))
|
delegate.switchState(IMEState.ofCommitting(textToCommit: displayedText))
|
||||||
}
|
}
|
||||||
delegate.switchState(IMEState.ofCommitting(textToCommit: " "))
|
delegate.switchState(IMEState.ofCommitting(textToCommit: " "))
|
||||||
|
|
Loading…
Reference in New Issue