Solution for clipboard bug (fix only for Mac)

I’ve found a convenient workaround for a bug where you copy code and it got past as an attachment instead of text in the chat. I used it a lot and it stressed me out that I needed to copy paste it somewhere to make it behave not like attachment.

The solution (Mac only) is this shortcut:

Apparently cursor looks for indentations and when I break the pattern it no longer consider code as an attachment and allows to insert it into conversation

I have it placed in dock so I copy paste, click icon on dock and insert as normally, but you can also attach a keyboard shortcut on that.

I’ve done it on my work machine where I don’t have access to iCloud so cannot share, but you probably can recreate from the image

The regex there - ^[ ]*

2 Likes

Hi @dimitrypo

Thanks for sharing your solution.

This is a great idea, but it isn’t working for me. I created the same shortcut, and it works when run in other apps; but in Cursor it does nothing.

Edit: Figured it out – you need to make sure the “Provide Output” checkbox is selected under the “Use as Quick Action” settings:

I used a slightly different regex input, fwiw, and it still works – just re-copying it to the clipboard seems to be what it needs. That must clear some flag that Cursor uses to know the copying was done in Cursor.

This seems to work now. Thank you!