Repo // Using new method to check client bundle identifiers.
This commit is contained in:
parent
5131fb523c
commit
787b5e4fd2
|
@ -18,6 +18,7 @@ import Cocoa
|
|||
|
||||
/// KeyHandler 委任協定
|
||||
protocol KeyHandlerDelegate {
|
||||
var clientBundleIdentifier: String { get }
|
||||
func ctlCandidate() -> ctlCandidateProtocol
|
||||
func keyHandler(
|
||||
_: KeyHandler, didSelectCandidateAt index: Int,
|
||||
|
|
|
@ -347,7 +347,7 @@ extension KeyHandler {
|
|||
composingBuffer = Tekkon.cnvPhonaToHanyuPinyin(target: composingBuffer) // 注音轉拼音
|
||||
}
|
||||
|
||||
if !IME.areWeUsingOurOwnPhraseEditor {
|
||||
if let delegate = delegate, !delegate.clientBundleIdentifier.contains("vChewingPhraseEditor") {
|
||||
composingBuffer = composingBuffer.replacingOccurrences(of: "-", with: " ")
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ class ctlInputMethod: IMKInputController {
|
|||
var state: InputStateProtocol = InputState.Empty()
|
||||
/// 當前這個 ctlInputMethod 副本是否處於英數輸入模式。
|
||||
var isASCIIMode: Bool = false
|
||||
|
||||
/// 記錄當前輸入環境是縱排輸入還是橫排輸入。
|
||||
public var isVerticalTyping: Bool {
|
||||
guard let client = client() else { return false }
|
||||
|
@ -233,15 +234,6 @@ class ctlInputMethod: IMKInputController {
|
|||
// 準備修飾鍵,用來判定要新增的詞彙是否需要賦以非常低的權重。
|
||||
ctlInputMethod.areWeNerfing = event.modifierFlags.contains([.shift, .command])
|
||||
|
||||
if let client = client(),
|
||||
client.bundleIdentifier()
|
||||
== "org.atelierInmu.vChewing.vChewingPhraseEditor"
|
||||
{
|
||||
IME.areWeUsingOurOwnPhraseEditor = true
|
||||
} else {
|
||||
IME.areWeUsingOurOwnPhraseEditor = false
|
||||
}
|
||||
|
||||
var input = InputSignal(event: event, isVerticalTyping: isVerticalTyping)
|
||||
input.isASCIIModeInput = isASCIIMode
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ import Cocoa
|
|||
// MARK: - KeyHandler Delegate
|
||||
|
||||
extension ctlInputMethod: KeyHandlerDelegate {
|
||||
var clientBundleIdentifier: String { client()?.bundleIdentifier() ?? "" }
|
||||
|
||||
func ctlCandidate() -> ctlCandidateProtocol { ctlInputMethod.ctlCandidateCurrent }
|
||||
|
||||
func keyHandler(
|
||||
|
@ -84,15 +86,6 @@ extension ctlInputMethod: ctlCandidateDelegate {
|
|||
// 準備修飾鍵,用來判定要新增的詞彙是否需要賦以非常低的權重。
|
||||
ctlInputMethod.areWeNerfing = event.modifierFlags.contains([.shift, .command])
|
||||
|
||||
if let client = client(),
|
||||
client.bundleIdentifier()
|
||||
== "org.atelierInmu.vChewing.vChewingPhraseEditor"
|
||||
{
|
||||
IME.areWeUsingOurOwnPhraseEditor = true
|
||||
} else {
|
||||
IME.areWeUsingOurOwnPhraseEditor = false
|
||||
}
|
||||
|
||||
var input = InputSignal(event: event, isVerticalTyping: isVerticalTyping)
|
||||
input.isASCIIModeInput = isASCIIMode
|
||||
|
||||
|
|
|
@ -40,10 +40,6 @@ public enum IME {
|
|||
return text
|
||||
}
|
||||
|
||||
// MARK: - 開關判定當前應用究竟是?
|
||||
|
||||
static var areWeUsingOurOwnPhraseEditor: Bool = false
|
||||
|
||||
// MARK: - 自 ctlInputMethod 讀取當前輸入法的簡繁體模式
|
||||
|
||||
static func getInputMode(isReversed: Bool = false) -> InputMode {
|
||||
|
|
Loading…
Reference in New Issue