New Tab + Paste (CMD-N CMD-V) sometimes becomes Paste + New Tab


#1

I often use Atom as a buffer, to paste stuff, check it and then paste it elsewhere.

So, I select some text from the terminal, or browser or something, switch to Atom and quickly press CMD-N CMD-V.

Lately I’ve noted that this often results in the wrong behaviour: CMD-N sometimes takes a lot of time, so the paste command is processed before the new tab is selected: the result is that in the end I’m in a new empty buffer, and the previous one is dirty with the pasted content.

While this is not a big deal, I’m puzzled by the non determinism of this bug: how comes that sometimes the text is pasted in the new buffer and sometimes in the old one?

Also: I would expect the paste command to only be processed once the new tab command is done with, but this doesn’t seem to be the case. Has this to do with some asynchronous stuff going on?


#2

Yes, that’s exactly it. A lot of events in Atom aren’t processed in a synchronous manner.