SessionCtl // Use NSMutableOrderedSet in lieu of Swift.Set.
This commit is contained in:
parent
fe41d16762
commit
337cf84c8b
|
@ -25,7 +25,7 @@ import UpdateSputnik
|
|||
/// 輸入會話創建一個控制器型別。因此,對於每個輸入會話,都有一個對應的 IMKInputController。
|
||||
@objc(SessionCtl) // 必須加上 ObjC,因為 IMK 是用 ObjC 寫的。
|
||||
public class SessionCtl: IMKInputController {
|
||||
public static var allInstances: Set<SessionCtl> = .init()
|
||||
public static var allInstances: NSMutableOrderedSet = .init()
|
||||
|
||||
/// 標記狀態來聲明目前新增的詞彙是否需要賦以非常低的權重。
|
||||
public static var areWeNerfing = false
|
||||
|
@ -207,7 +207,7 @@ extension SessionCtl {
|
|||
|
||||
state = IMEState.ofEmpty()
|
||||
isActivated = true // 登記啟用狀態。
|
||||
Self.allInstances.insert(self)
|
||||
Self.allInstances.insert(self, at: 0)
|
||||
setKeyLayout()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ extension SessionCtl {
|
|||
// 所以在這裡糾偏一下、讓所有開啟了選字窗的會話重新顯示選字窗。
|
||||
if PrefMgr.shared.useIMKCandidateWindow {
|
||||
for instance in Self.allInstances {
|
||||
guard let instance = instance as? SessionCtl else { continue }
|
||||
guard let imkC = instance.ctlCandidateCurrent as? CtlCandidateIMK else { continue }
|
||||
if instance.state.isCandidateContainer, !imkC.visible {
|
||||
instance.handle(state: instance.state, replace: false)
|
||||
|
|
Loading…
Reference in New Issue