Skip to content

Commit

Permalink
Fix copy/paste in vscode on hardware kb
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Dec 20, 2021
1 parent d912618 commit 91cd329
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Blink/SmarterKeys/SmarterTermInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ class CaretHider {
kbView.setNeedsLayout()
}

func shouldUseWKCopyAndPaste() -> Bool {
false
}

private var _caretHider: CaretHider? = nil

override func ready() {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -556,6 +568,10 @@ extension SmarterTermInput: TermInput {
}

class VSCodeInput: SmarterTermInput {
override func shouldUseWKCopyAndPaste() -> Bool {
true
}

override func canBeFocused() -> Bool {
let res = super.canBeFocused()

Expand Down

0 comments on commit 91cd329

Please sign in to comment.