Skip to content

Conversation

@BartolHrg
Copy link
Contributor

When having emptySelectionClipboard: true,
and when you have multiple cursors and all of them are empty,
and when we copy,
each cursor should copy its own line.

Fixes: #256039

There is a room for improvement: mainly, when pasting, VSCode pastes at the cursor position, not in the line above (like it does with just one cursor and copying of the empty selection).
(reference 1 (for later))

Testing:

  1. Set emptySelectionClipboard: true in settings
  2. Open new file
  3. Write this and put 2 cursors in place of |. Nothing is selected.
a|
b|
  1. Copy
  2. Paste

Currently, it copies "a\nb\n" in both places:

aa
b

ba
b

It should produce

a
a
b
b

But because aforementioned issue (reference 1), it produces

aa

bb

Which is good enough (and better than what we currently have).

Though, this can be easily avoided by, before Pasting, setting cursors at the beginning of the lines:

|a
|b

And then Paste correctly produces

a
a
b
b

@BartolHrg
Copy link
Contributor Author

@alexdima I think your unit tests in cursor.test.ts are wrong.
They are identical, but with different asserts. How can you expect different result after the same action?
1st test seems ok.
2nd test is old behaviour. I guess you wanted to use assert.notStrictEqual? Or maybe you wanted single selection to be pasted into multiple cursors viewModel.paste("line1\nline2\n", true, null)?
Also you named the test "issue #256083"
That's id of this PR, and id of the issue is #256039.

@BartolHrg
Copy link
Contributor Author

@microsoft-github-policy-service agree

@vs-code-engineering vs-code-engineering bot added this to the December / January 2026 milestone Dec 17, 2025
@BartolHrg
Copy link
Contributor Author

Should I be the one to merge it (I would guess not)
Or will you handle it?

@BartolHrg
Copy link
Contributor Author

Should I be the one to merge it (I would guess not) Or will you handle it?

I don't see the button anywhere, so I'll leave it to you.

@alexdima alexdima merged commit 1387398 into microsoft:main Dec 18, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple cursor copy-paste of non-selected lines pastes everything

5 participants