InputHandler // Allow committing composer / calligrapher contents.
- Requiring that the compositor is empty.
This commit is contained in:
parent
035893838c
commit
7e57eb74c1
|
@ -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)」的匹配記錄。")
|
||||||
|
|
|
@ -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")
|
||||||
|
|
Loading…
Reference in New Issue