ctlIME // Determine whether vertical candidates shall be enforced.

This commit is contained in:
ShikiSuen 2022-06-04 11:28:41 +08:00
parent d67a6fd28f
commit 5a40f24ff8
1 changed files with 8 additions and 17 deletions

View File

@ -462,7 +462,7 @@ extension ctlInputMethod {
extension ctlInputMethod {
private func show(candidateWindowWith state: InputState, client: Any!) {
let useVerticalMode: Bool = {
var useVerticalMode: Bool {
var useVerticalMode = false
var candidates: [String] = []
if let state = state as? InputState.ChoosingCandidate {
@ -476,22 +476,13 @@ extension ctlInputMethod {
candidates.sort {
$0.count > $1.count
}
if let candidateFirst = candidates.first {
// If there is a candidate which is too long, we use the vertical
// candidate list window automatically.
if candidateFirst.count > 8 {
// return true //
}
}
// 使
// for
for candidate in candidates {
if ["顏文字", "颜文字"].contains(candidate), mgrPrefs.symbolInputEnabled {
return true
}
}
return false
}()
// 使
// Beer emoji
let maxCandidatesPerPage = mgrPrefs.candidateKeys.count
let firstPageCandidates = candidates[0..<min(maxCandidatesPerPage, candidates.count)]
return firstPageCandidates.joined().count > Int(round(Double(maxCandidatesPerPage) * 1.8))
// true
}
ctlCandidateCurrent?.delegate = nil