SessionCtl // Change how updateVerticalTypingStatus() gets triggered.
This commit is contained in:
parent
00ce1f23ce
commit
b64910d7a5
|
@ -106,14 +106,12 @@ public class SessionCtl: IMKInputController {
|
|||
isVerticalTyping = false
|
||||
return
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
var textFrame = NSRect.seniorTheBeast
|
||||
let attributes: [AnyHashable: Any]? = client.attributes(
|
||||
forCharacterIndex: 0, lineHeightRectangle: &textFrame
|
||||
)
|
||||
let result = (attributes?["IMKTextOrientation"] as? NSNumber)?.intValue == 0 || false
|
||||
self.isVerticalTyping = result
|
||||
}
|
||||
isVerticalTyping = result
|
||||
}
|
||||
|
||||
/// InputMode 需要在每次出現內容變更的時候都連帶重設組字器與各項語言模組,
|
||||
|
@ -213,7 +211,6 @@ extension SessionCtl {
|
|||
public override func activateServer(_ sender: Any!) {
|
||||
_ = sender // 防止格式整理工具毀掉與此對應的參數。
|
||||
DispatchQueue.main.async { [self] in
|
||||
defer { updateVerticalTypingStatus() }
|
||||
if let senderBundleID: String = (sender as? IMKTextInput)?.bundleIdentifier() {
|
||||
vCLog("activateServer(\(senderBundleID))")
|
||||
isServingIMEItself = Bundle.main.bundleIdentifier == senderBundleID
|
||||
|
|
|
@ -73,6 +73,7 @@ extension SessionCtl {
|
|||
|
||||
public func showCandidates() {
|
||||
guard let client = client() else { return }
|
||||
updateVerticalTypingStatus()
|
||||
state.isVerticalCandidateWindow = (isVerticalTyping || !PrefMgr.shared.useHorizontalCandidateList)
|
||||
|
||||
/// 無論是田所選字窗還是 IMK 選字窗,在這裡都有必要重新初期化。
|
||||
|
|
|
@ -119,6 +119,7 @@ extension SessionCtl {
|
|||
|
||||
// 如果是方向鍵輸入的話,就想辦法帶上標記資訊、來說明當前是縱排還是橫排。
|
||||
if event.isUp || event.isDown || event.isLeft || event.isRight {
|
||||
updateVerticalTypingStatus() // 檢查當前環境是否是縱排輸入。
|
||||
eventToDeal = event.reinitiate(charactersIgnoringModifiers: isVerticalTyping ? "Vertical" : "Horizontal") ?? event
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue