From 91cd3292578544d21d46386cdb56e0e5aa4fe42c Mon Sep 17 00:00:00 2001 From: Yury Korolev Date: Mon, 20 Dec 2021 13:32:53 +0300 Subject: [PATCH] Fix copy/paste in vscode on hardware kb --- Blink/SmarterKeys/SmarterTermInput.swift | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Blink/SmarterKeys/SmarterTermInput.swift b/Blink/SmarterKeys/SmarterTermInput.swift index 56608aed3..0f2dfb39a 100644 --- a/Blink/SmarterKeys/SmarterTermInput.swift +++ b/Blink/SmarterKeys/SmarterTermInput.swift @@ -96,6 +96,10 @@ class CaretHider { kbView.setNeedsLayout() } + func shouldUseWKCopyAndPaste() -> Bool { + false + } + private var _caretHider: CaretHider? = nil override func ready() { @@ -468,11 +472,19 @@ extension SmarterTermInput { } override func copy(_ sender: Any?) { - device?.view?.copy(sender) + if shouldUseWKCopyAndPaste() { + super.copy(sender) + } else { + device?.view?.copy(sender) + } } override func paste(_ sender: Any?) { - device?.view?.paste(sender) + if shouldUseWKCopyAndPaste() { + super.paste(sender) + } else { + device?.view?.paste(sender) + } } @objc func copyLink(_ sender: Any) { @@ -556,6 +568,10 @@ extension SmarterTermInput: TermInput { } class VSCodeInput: SmarterTermInput { + override func shouldUseWKCopyAndPaste() -> Bool { + true + } + override func canBeFocused() -> Bool { let res = super.canBeFocused()