johnlindquist / kit

Script Kit. Automate Anything.
https://scriptkit.com
MIT License
3.91k stars 138 forks source link

Extra space breaks clipboard expected behaviour of the Clipboard #v2 #1417

Closed joeyvandijk closed 10 months ago

joeyvandijk commented 10 months ago

When using ScriptKit 2.2.8 on macos Sonoma 14.2.1 I noticed that since v2 the clipboard history (open Scriptkit > type C > type Enter) did not work anymore ❌. It kept showing me a list

Screenshot 2024-01-03 at 11 11 33

while I noticed that in the input field a space existed and therefore I got the same results everytime. When removing the space with clicking backspace I got

Screenshot 2024-01-03 at 11 11 48

which worked as expected. ✅

I suppose after the shortcut keyword c the input field get an empty space that should be removed to ensure expected behaviour for the clipboard (at least on Mac) again.

johnlindquist commented 10 months ago

@joeyvandijk Oh, I see:

c is a "keyword" and keyword behaviors are triggered by the keyword then a spacebar. So typing: c then space will bring up the clipboard history and allow you to press delete to remove the keyword and go back to the main menu.

If you want to patch this, you can run this script:

// Name: Fix Clipboard

import "@johnlindquist/kit"

await replace({
  files: kitPath("main", "clipboard-history.js"),
  from: "input: keyword + ` `",
  to: "input: keyword ? keyword + ` ` : ``",
})

install fix clipboard

I'll get this truly fixed in the next release

joeyvandijk commented 10 months ago

I understand and a good fix for a new release. Thanks for now 👍