InputHandler // Allow committing composer / calligrapher contents.

- Requiring that the compositor is empty.
This commit is contained in:
ShikiSuen 2022-11-26 04:19:02 +08:00
parent 035893838c
commit 7e57eb74c1
2 changed files with 25 additions and 3 deletions

View File

@ -86,6 +86,11 @@ extension InputHandler {
// readingKey // readingKey
composeReading = composeReading && !readingKey.isEmpty composeReading = composeReading && !readingKey.isEmpty
if composeReading { if composeReading {
if input.isControlHold, input.isCommandHold, input.isEnter,
!input.isOptionHold, !input.isShiftHold, compositor.isEmpty
{
return handleCtrlCommandEnter()
}
// //
if !currentLM.hasUnigramsFor(key: readingKey) { if !currentLM.hasUnigramsFor(key: readingKey) {
delegate.callError("B49C0979語彙庫內無「\(readingKey)」的匹配記錄。") delegate.callError("B49C0979語彙庫內無「\(readingKey)」的匹配記錄。")
@ -229,6 +234,11 @@ extension InputHandler {
// |= // |=
combineStrokes = combineStrokes || (!calligrapher.isEmpty && confirmCombination) combineStrokes = combineStrokes || (!calligrapher.isEmpty && confirmCombination)
if combineStrokes { if combineStrokes {
if input.isControlHold, input.isCommandHold, input.isEnter,
!input.isOptionHold, !input.isShiftHold, composer.isEmpty
{
return handleCtrlCommandEnter()
}
// //
if !currentLM.hasUnigramsFor(key: calligrapher) { if !currentLM.hasUnigramsFor(key: calligrapher) {
delegate.callError("B49C0979_Cassette語彙庫內無「\(calligrapher)」的匹配記錄。") delegate.callError("B49C0979_Cassette語彙庫內無「\(calligrapher)」的匹配記錄。")

View File

@ -298,9 +298,21 @@ extension InputHandler {
guard state.type == .ofInputting else { return false } guard state.type == .ofInputting else { return false }
var displayedText = compositor.keys.joined(separator: "\t") var displayedText = compositor.keys.joined(separator: "\t")
if prefs.inlineDumpPinyinInLieuOfZhuyin, !prefs.cassetteEnabled { if compositor.isEmpty {
displayedText = Tekkon.restoreToneOneInZhuyinKey(target: displayedText) // displayedText = readingForDisplay
displayedText = Tekkon.cnvPhonaToHanyuPinyin(target: displayedText) // }
if !prefs.cassetteEnabled {
if prefs.inlineDumpPinyinInLieuOfZhuyin {
if !compositor.isEmpty {
displayedText = Tekkon.restoreToneOneInZhuyinKey(target: displayedText) //
}
displayedText = Tekkon.cnvPhonaToHanyuPinyin(target: displayedText) //
}
if prefs.showHanyuPinyinInCompositionBuffer {
if compositor.isEmpty {
displayedText = displayedText.replacingOccurrences(of: "1", with: "")
}
}
} }
let isVCED = delegate.clientBundleIdentifier.contains("vChewingPhraseEditor") let isVCED = delegate.clientBundleIdentifier.contains("vChewingPhraseEditor")