ctlIME // Add ctlCandidateVertical pos for horizontal typing.
This commit is contained in:
parent
05fbc1bf23
commit
1c3eef6400
|
@ -458,16 +458,22 @@ extension ctlInputMethod {
|
||||||
extension ctlInputMethod {
|
extension ctlInputMethod {
|
||||||
private func show(candidateWindowWith state: InputState, client: Any!) {
|
private func show(candidateWindowWith state: InputState, client: Any!) {
|
||||||
var isTypingVertical: Bool {
|
var isTypingVertical: Bool {
|
||||||
var isTypingVertical = false
|
if let state = state as? InputState.ChoosingCandidate {
|
||||||
|
return state.isTypingVertical
|
||||||
|
} else if let state = state as? InputState.AssociatedPhrases {
|
||||||
|
return state.isTypingVertical
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
var isCandidateWindowVertical: Bool {
|
||||||
var candidates: [String] = []
|
var candidates: [String] = []
|
||||||
if let state = state as? InputState.ChoosingCandidate {
|
if let state = state as? InputState.ChoosingCandidate {
|
||||||
isTypingVertical = state.isTypingVertical
|
|
||||||
candidates = state.candidates
|
candidates = state.candidates
|
||||||
} else if let state = state as? InputState.AssociatedPhrases {
|
} else if let state = state as? InputState.AssociatedPhrases {
|
||||||
isTypingVertical = state.isTypingVertical
|
|
||||||
candidates = state.candidates
|
candidates = state.candidates
|
||||||
}
|
}
|
||||||
if isTypingVertical { return true }
|
if isTypingVertical { return true }
|
||||||
|
// 以上是通用情形。接下來決定橫排輸入時是否使用縱排選字窗。
|
||||||
candidates.sort {
|
candidates.sort {
|
||||||
$0.count > $1.count
|
$0.count > $1.count
|
||||||
}
|
}
|
||||||
|
@ -481,7 +487,7 @@ extension ctlInputMethod {
|
||||||
|
|
||||||
ctlCandidateCurrent.delegate = nil
|
ctlCandidateCurrent.delegate = nil
|
||||||
|
|
||||||
if isTypingVertical {
|
if isCandidateWindowVertical { // 縱排輸入時強制使用縱排選字窗
|
||||||
ctlCandidateCurrent.currentLayout = .vertical
|
ctlCandidateCurrent.currentLayout = .vertical
|
||||||
} else if mgrPrefs.useHorizontalCandidateList {
|
} else if mgrPrefs.useHorizontalCandidateList {
|
||||||
ctlCandidateCurrent.currentLayout = .horizontal
|
ctlCandidateCurrent.currentLayout = .horizontal
|
||||||
|
|
Loading…
Reference in New Issue