code-clip-ring icon indicating copy to clipboard operation
code-clip-ring copied to clipboard

Copy entire line

Open Christilut opened this issue 6 years ago • 1 comments

Seems like the ring paste is behaving a bit different than normal paste. When I put my cursor in a location anywhere on a line (without highlighting anything) and copy, then pasting somewhere else would paste the entire line. The ring paste seems to only paste the text and not the line endings, so a copied line is pasted at the location of the cursor and not inserted above the current line, as I would expect.

Christilut avatar Feb 25 '19 14:02 Christilut

Yeah you are right. the behavior is different... I'm not sure how exactly to fix that... or if I even want to... it seems that vscode has the following behavior:

  • you copy a line by using the copy action and having nothing selected
  • you paste using the paste action and it will insert a new line before the one where the current caret is, regardless of where the caret is in that line

This is different from the following:

  • select a line, including the line ending
  • then use the copy action
  • now, use the paste action
  • it will now insert the copied text (including the line ending) exactly at the position the caret is.

I have to investigate this, because I don't even see how vscode decides between the two at the time you use paste. Also... how would that behavior look for code clip ring? don't see it at the moment, because vscode inserts the line at another point from where the caret is, which doesn't go well with the code clip ring behavior.

SrTobi avatar Feb 25 '19 16:02 SrTobi