You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the title states, calling getSelectedText() will give you the currently selected text in whatever application is open. However, it also copies that text to the clipboard. This is, in my opinion, an unexpected and undocumented side effect.
Consider this simple script to replace the selected text with a markdown link:
But this doesn't work because when I hit cmd+v in the prompt, it just pastes in the text I've already selected, overriding the previous clipboard contents.
Now, it's fairly easy to work around this with a helper like this:
Something like this be worked into the internal implementation of getSelectedText(), because this workaround will have unintended effects on clipboard history for those that use it, OR
This behavior be documented in the API (That's a change I'd be happy to contribute myself if the first option is not acceptable)
The text was updated successfully, but these errors were encountered:
As the title states, calling
getSelectedText()
will give you the currently selected text in whatever application is open. However, it also copies that text to the clipboard. This is, in my opinion, an unexpected and undocumented side effect.Consider this simple script to replace the selected text with a markdown link:
My intended workflow for this is:
But this doesn't work because when I hit cmd+v in the prompt, it just pastes in the text I've already selected, overriding the previous clipboard contents.
Now, it's fairly easy to work around this with a helper like this:
But I would still argue that either:
getSelectedText()
, because this workaround will have unintended effects on clipboard history for those that use it, ORThe text was updated successfully, but these errors were encountered: