mattcaffeine

snippet followed by paste causes outputs snippet again instead of clipboard content

5 posts in this topic

Snippet entry followed immediately by a paste command, seems to result in pasting the contents of the snippet, rather than the top item of my clipboard. Example below. 

Clipboard is also managed by Alfred. 

 

If I wait a full second or two before pasting, my clipboard contents are pasted correctly, and confirm that my clipboard list does not include the snippet text. I do not see a setting to reduce this delay, so I suspect this is a bug. 

 

* what were you doing when the issue happened

Entered keyword for snippet, immediately followed by Cmd+V for pasting my clipboard contents. 

 

I realize that I can use "{clipboard}" for this, but to keep my snippets more flexible, I prefer paste separate from the snippet action. 

 

* Whether you were able to replicate it a second time by performing the same action
Confirmed this issue exists in several applications. (Primarily seen in iTerm2)
 
* Include any screenshots that might help us
 
Strictly a text/snippet issue, so example below-
$ ps -ef | grep ps -ef grep

Expected:

$ ps -ef | grep 12345

where "12345" is the current contents of my clipboard.

 
* Include the Alfred version & build number you are using
v3.0.3 [694]
 
* Include your OS X version
10.11.5
Edited by mattcaffeine

Share this post


Link to post

 

Snippet entry followed immediately by a paste command, seems to result in pasting the contents of the snippet, rather than the top item of my clipboard. Example below. 

Clipboard is also managed by Alfred. 

 

If I wait a full second or two before pasting, my clipboard contents are pasted correctly, and confirm that my clipboard list does not include the snippet text. I do not see a setting to reduce this delay, so I suspect this is a bug. 

 

 

Hi Matt,

 

Currently, this delay is set to 0.5 second and is fixed, but this may be configurable in the future. I've added a note for consideration in a future update. :)

 

Cheers,

Vero

Share this post


Link to post

Would it be possible to consider queuing the paste request and pasting the correct item after the delay?

 

Edit - never mind, I don't think that would work. Changing the delay, or making that editable, would be great, thanks!

Edited by mattcaffeine

Share this post


Link to post

What is the delay for? Does Alfred use the clipboard behind the scenes to make the magic work?

 

Last week I've migrated away from TextExpander to use Alfred snippets instead. If noticed a few quirks since the change - and this one is by far the most annoying. If TextExpander works the same way behind the scenes, perhaps have a look at what their delay is, since I never had the issue before.

 

If you're interested in why it's problematic for me:

You can wrap text in Skype, similar to markdown, to use a monospaced font. {code}Hello World{code}

I have a snippet for {code}. 75% of the time I'll paste my clipboard in after using that snippet, but the other 25% of the time I'll hand-write some code. I could try to separate those into two distinct snippets, but it seems painful to re-learn, and for no real productivity gain.

Share this post


Link to post

What is the delay for? Does Alfred use the clipboard behind the scenes to make the magic work?

 

 

AFAIK, most snippet expander apps use the clipboard to do their thing. Certainly Text Expander does.

 

The delay is how long Alfred (or TE) waits before restoring the previous clipboard contents (to allow enough time for the simulated paste event to succeed with the snippet contents). In TE, the delay is configurable and (IIRC) has a more aggressive (i.e. shorter) default. Or you set a shorter delay yourself a long time ago (as I did).

 

If the delay is too short, the previous clipboard contents might be restored before the paste event succeeds, thus inserting the clipboard contents instead of the snippet (the opposite of the issue you're having).

 

IMO, the delay should definitely be configurable, as some machines are much faster than others. With a non-configurable delay, Alfred has to be very conservative to ensure snippet expansion works on slow Macs.

Edited by deanishe
anil likes this

Share this post


Link to post