I somehow play the necromancer here as I have implemented the ST multi-cursors paste in Atom as a package.
__ IMPORTANT: This package is mostly experimental and meant to be a proof of concept, it hacks into Atom in a quite dirty way and may break with an update.__
It monkey patches the
Selection::copy methods to provides support for pasting multiple-cursors selections, given that the number of cursors is the same, otherwise it behaves as done actually.
Multiple Cursors Clipboard package
@ProbablyCorey, @kevinsawicki and @nathansobo (and any other person working on Atom for GitHub): I don’t know if you already have this feature/fix in your roadmap, but if not I’ll be pleased if you could give a look at this to tell me if you see any issue and if it can makes its way to the core code.
So now, how does it works:
Looking at the atom sources, I found that copying from multiple selections was already handled with a special case, the
selection.copy method was called with the
maintainClipboard set to true. In that case, each selection is concatenated to the previous clipboard, and no metadata is provided.
All I did there was to store an array containing each selection text in the metadata.
Then, in the
Editor::pasteText method, I check for the presence of the metadata array, if it exists and if the current selections count is the same, then I mutate each selection with the corresponding entry from the clipboard and return from the function (preventing the default behavior). Otherwise it just go with the default behavior, where I only changed the test for the presence of
metadata? to test the presence of