Internally, Sublime normalizes all text to use \n
as line termination; thus the behaviour you’re seeing here is the same across all platform regardless of line endings, and is doing what it does on purpose.
When there are multiple selections and you copy, the clipboard is filled with the text of all of the selections joined together by newlines:
The reason for this is that when you paste with multiple cursors, the text in the clipboard is split on newlines into separate strings:
- If there are exactly as many strings as cursors, one string goes to each cursor when you paste
- If there is not a match, all of the text goes to all of the cursors.
Newline is chosen here because otherwise if you paste multi selected text with one cursor (or outside of Sublime) you don’t see what you expect.
The issue you’re seeing here (or at least the one the OP was having) has to do with what the command that expands the selection to a line does, which is (as the name suggests) expands the selection to the entire line:
As seen in the image, the cursor is visibly on the line 3, which means that the selection spans all of line 2 including the newline on the end.
If you were to do this with multiple lines at once:
What you end up getting is the two lines, plus their newlines, being joined by the newline separator. Now when you paste it, you get doubled line spacing.
If you want to do this and keep the actual lines, the selection can’t include the newlines on the end of the selection:
Here after I made the selection, I used shift+left
to shorten all of the selections by a single character, so that they don’t include the newline. Things then paste as you expect