Merge pull request #289 from zonble/master

Fixes an Swift type conversion issue which happens while typing in Terminal app
This commit is contained in:
Lukhnos Liu 2022-02-14 19:48:44 -08:00 committed by GitHub
commit b4704ff7e4
1 changed files with 2 additions and 2 deletions

View File

@ -178,7 +178,7 @@ class McBopomofoInputMethodController: IMKInputController {
let useVerticalMode = (attributes?["IMKTextOrientation"] as? NSNumber)?.intValue == 0 || false
if (client as? IMKTextInput)?.bundleIdentifier() == "com.apple.Terminal" &&
NSStringFromClass(client.self as! AnyClass) == "IPMDServerClientWrapper" {
String(describing: client.self) == "IPMDServerClientWrapper" {
currentDeferredClient = client
}
@ -312,7 +312,7 @@ extension McBopomofoInputMethodController {
// if it's Terminal, we don't commit at the first call (the client of which will not be IPMDServerClientWrapper)
// then we defer the update in the next runloop round -- so that the composing buffer is not
// meaninglessly flushed, an annoying bug in Terminal.app since Mac OS X 10.5
if (client as? IMKTextInput)?.bundleIdentifier() == "com.apple.Terminal" && NSStringFromClass(client.self as! AnyClass) != "IPMDServerClientWrapper" {
if (client as? IMKTextInput)?.bundleIdentifier() == "com.apple.Terminal" && String(describing: client.self) != "IPMDServerClientWrapper" {
let innerCurrentDeferredClient = currentDeferredClient
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()) {
(innerCurrentDeferredClient as? IMKTextInput)?.insertText(buffer, replacementRange: NSRange(location: NSNotFound, length: NSNotFound))