From 3a3310cc8e1c5923775e4d8bcc18bd92c13c5bf4 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 14 Feb 2022 20:45:18 +0800 Subject: [PATCH] ctlInputMethod // Make the IME works with Terminal.app from now on. --- Source/Modules/IMEModules/ctlInputMethod.swift | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Source/Modules/IMEModules/ctlInputMethod.swift b/Source/Modules/IMEModules/ctlInputMethod.swift index 303714be..c4f97a12 100644 --- a/Source/Modules/IMEModules/ctlInputMethod.swift +++ b/Source/Modules/IMEModules/ctlInputMethod.swift @@ -186,11 +186,6 @@ class ctlInputMethod: IMKInputController { let attributes: [AnyHashable: Any]? = (client as? IMKTextInput)?.attributes(forCharacterIndex: 0, lineHeightRectangle: &textFrame) let useVerticalMode = (attributes?["IMKTextOrientation"] as? NSNumber)?.intValue == 0 || false - if (client as? IMKTextInput)?.bundleIdentifier() == "com.apple.Terminal" && - NSStringFromClass(client.self as! AnyClass) == "IPMDServerClientWrapper" { - currentDeferredClient = client - } - let input = KeyHandlerInput(event: event, isVerticalMode: useVerticalMode) let result = keyHandler.handle(input: input, state: state) { newState in @@ -332,15 +327,6 @@ extension ctlInputMethod { if buffer.isEmpty { return } - // 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" { - let innerCurrentDeferredClient = currentDeferredClient - DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()) { - (innerCurrentDeferredClient as? IMKTextInput)?.insertText(buffer, replacementRange: NSRange(location: NSNotFound, length: NSNotFound)) - } - } (client as? IMKTextInput)?.insertText(buffer, replacementRange: NSRange(location: NSNotFound, length: NSNotFound)) }