Skip to content

Commit

Permalink
fix(candidates): 修复候选词的问题
Browse files Browse the repository at this point in the history
1. 修复偏好设置中设置了候选词数量不生效的问题
2. 优化在没有候选词时,由于没有候选窗口,导致显示方面的一些异常问题,优化后,当没有五笔或拼音候选词时,使用输入的英文字母作为候选词显示在候选窗口中
  • Loading branch information
qwertyyb committed Feb 18, 2021
1 parent c0922a1 commit 1c3a35b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Fire/Fire.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,14 @@ class Fire: NSObject {
let candidate = Candidate(code: code, text: text, type: type)
candidates.append(candidate)
}
return (Array(candidates.prefix(5)), hasNext: candidates.count > Defaults[.candidateCount])
let count = Defaults[.candidateCount]
candidates = Array(candidates.prefix(count))

if candidates.isEmpty {
candidates.append(Candidate(code: origin, text: origin, type: "wb"))
}

return (candidates, hasNext: candidates.count > count)
}

static let shared = Fire()
Expand Down

0 comments on commit 1c3a35b

Please sign in to comment.