Repo // Disabling pinyin-phonabet conversion in cassette mode. (#215)
- Also fix the separator conversion in handleCtrlCommandEnter().
This commit is contained in:
parent
1273ebdbb9
commit
a21e2c812c
|
@ -186,15 +186,17 @@ extension IMEStateData {
|
|||
arrOutput.append("??")
|
||||
continue
|
||||
}
|
||||
if PrefMgr.shared.showHanyuPinyinInCompositionBuffer,
|
||||
PrefMgr.shared.alwaysShowTooltipTextsHorizontally || !isVerticalTyping
|
||||
{
|
||||
// 恢復陰平標記->注音轉拼音->轉教科書式標調
|
||||
neta = Tekkon.restoreToneOneInZhuyinKey(target: neta)
|
||||
neta = Tekkon.cnvPhonaToHanyuPinyin(target: neta)
|
||||
neta = Tekkon.cnvHanyuPinyinToTextbookStyle(target: neta)
|
||||
} else {
|
||||
neta = Tekkon.cnvZhuyinChainToTextbookReading(target: neta)
|
||||
if !PrefMgr.shared.cassetteEnabled {
|
||||
if PrefMgr.shared.showHanyuPinyinInCompositionBuffer,
|
||||
PrefMgr.shared.alwaysShowTooltipTextsHorizontally || !isVerticalTyping
|
||||
{
|
||||
// 恢復陰平標記->注音轉拼音->轉教科書式標調
|
||||
neta = Tekkon.restoreToneOneInZhuyinKey(target: neta)
|
||||
neta = Tekkon.cnvPhonaToHanyuPinyin(target: neta)
|
||||
neta = Tekkon.cnvHanyuPinyinToTextbookStyle(target: neta)
|
||||
} else {
|
||||
neta = Tekkon.cnvZhuyinChainToTextbookReading(target: neta)
|
||||
}
|
||||
}
|
||||
arrOutput.append(neta)
|
||||
}
|
||||
|
|
|
@ -291,14 +291,14 @@ extension InputHandler {
|
|||
let state = delegate.state
|
||||
guard state.type == .ofInputting else { return false }
|
||||
|
||||
var displayedText = compositor.keys.joined(separator: "-")
|
||||
if prefs.inlineDumpPinyinInLieuOfZhuyin {
|
||||
var displayedText = compositor.keys.joined(separator: " ")
|
||||
if prefs.inlineDumpPinyinInLieuOfZhuyin, !prefs.cassetteEnabled {
|
||||
displayedText = Tekkon.restoreToneOneInZhuyinKey(target: displayedText) // 恢復陰平標記
|
||||
displayedText = Tekkon.cnvPhonaToHanyuPinyin(target: displayedText) // 注音轉拼音
|
||||
}
|
||||
|
||||
if !delegate.clientBundleIdentifier.contains("vChewingPhraseEditor") {
|
||||
displayedText = displayedText.replacingOccurrences(of: "-", with: " ")
|
||||
if delegate.clientBundleIdentifier.contains("vChewingPhraseEditor") {
|
||||
displayedText = displayedText.replacingOccurrences(of: " ", with: "-")
|
||||
}
|
||||
|
||||
delegate.switchState(IMEState.ofCommitting(textToCommit: displayedText))
|
||||
|
@ -318,13 +318,15 @@ extension InputHandler {
|
|||
|
||||
for node in compositor.walkedNodes {
|
||||
var key = node.key
|
||||
if prefs.inlineDumpPinyinInLieuOfZhuyin {
|
||||
key = Tekkon.restoreToneOneInZhuyinKey(target: key) // 恢復陰平標記
|
||||
key = Tekkon.cnvPhonaToHanyuPinyin(target: key) // 注音轉拼音
|
||||
key = Tekkon.cnvHanyuPinyinToTextbookStyle(target: key) // 轉教科書式標調
|
||||
key = key.replacingOccurrences(of: "-", with: " ")
|
||||
} else {
|
||||
key = Tekkon.cnvZhuyinChainToTextbookReading(target: key, newSeparator: " ")
|
||||
if !prefs.cassetteEnabled {
|
||||
if prefs.inlineDumpPinyinInLieuOfZhuyin {
|
||||
key = Tekkon.restoreToneOneInZhuyinKey(target: key) // 恢復陰平標記
|
||||
key = Tekkon.cnvPhonaToHanyuPinyin(target: key) // 注音轉拼音
|
||||
key = Tekkon.cnvHanyuPinyinToTextbookStyle(target: key) // 轉教科書式標調
|
||||
key = key.replacingOccurrences(of: "-", with: " ")
|
||||
} else {
|
||||
key = Tekkon.cnvZhuyinChainToTextbookReading(target: key, newSeparator: " ")
|
||||
}
|
||||
}
|
||||
|
||||
let value = node.value
|
||||
|
|
|
@ -27,9 +27,11 @@ extension SessionCtl {
|
|||
var result = (theCandidate.1 == theConverted) ? theCandidate.1 : "\(theConverted)\u{1A}(\(theCandidate.1))"
|
||||
if arrResult.contains(result) {
|
||||
let reading: String =
|
||||
PrefMgr.shared.showHanyuPinyinInCompositionBuffer
|
||||
? Tekkon.cnvPhonaToHanyuPinyin(target: Tekkon.restoreToneOneInZhuyinKey(target: theCandidate.0))
|
||||
: theCandidate.0
|
||||
PrefMgr.shared.cassetteEnabled
|
||||
? theCandidate.0
|
||||
: (PrefMgr.shared.showHanyuPinyinInCompositionBuffer
|
||||
? Tekkon.cnvPhonaToHanyuPinyin(target: Tekkon.restoreToneOneInZhuyinKey(target: theCandidate.0))
|
||||
: theCandidate.0)
|
||||
result = "\(result)\u{17}(\(reading))"
|
||||
}
|
||||
arrResult.append(prefix + result)
|
||||
|
@ -85,8 +87,10 @@ extension SessionCtl {
|
|||
let theConverted = ChineseConverter.kanjiConversionIfRequired(neta.1)
|
||||
let netaShown = (neta.1 == theConverted) ? neta.1 : "\(theConverted)\u{1A}(\(neta.1))"
|
||||
let reading: String =
|
||||
PrefMgr.shared.showHanyuPinyinInCompositionBuffer
|
||||
? Tekkon.cnvPhonaToHanyuPinyin(target: Tekkon.restoreToneOneInZhuyinKey(target: neta.0)) : neta.0
|
||||
PrefMgr.shared.cassetteEnabled
|
||||
? neta.0
|
||||
: (PrefMgr.shared.showHanyuPinyinInCompositionBuffer
|
||||
? Tekkon.cnvPhonaToHanyuPinyin(target: Tekkon.restoreToneOneInZhuyinKey(target: neta.0)) : neta.0)
|
||||
let netaShownWithPronunciation = "\(netaShown)\u{17}(\(reading))"
|
||||
if candidateString == prefix + netaShownWithPronunciation {
|
||||
indexDeducted = i
|
||||
|
|
Loading…
Reference in New Issue