Repo // Using new method to check client bundle identifiers.

This commit is contained in:
ShikiSuen 2022-08-14 16:27:13 +08:00
parent 5131fb523c
commit 787b5e4fd2
5 changed files with 5 additions and 23 deletions

View File

@ -18,6 +18,7 @@ import Cocoa
/// KeyHandler
protocol KeyHandlerDelegate {
var clientBundleIdentifier: String { get }
func ctlCandidate() -> ctlCandidateProtocol
func keyHandler(
_: KeyHandler, didSelectCandidateAt index: Int,

View File

@ -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: " ")
}

View File

@ -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

View File

@ -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

View File

@ -40,10 +40,6 @@ public enum IME {
return text
}
// MARK: -
static var areWeUsingOurOwnPhraseEditor: Bool = false
// MARK: - ctlInputMethod
static func getInputMode(isReversed: Bool = false) -> InputMode {