microsoft / microsoft/vscode

Copying multiple empty selections adds blank lines when pasted into a single cursor

Open
#324,290 0 comments 0 reactions 1 assignee Claimed by @alexdima View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Does this issue occur when all extensions are disabled?: Unknown

- VS Code Version: Reproduced in 1.108.0 through 1.127.0; does not reproduce in 1.107.x or 1.98.1
- OS Version: Microsoft Windows 11 Pro 10.0.26100 (26100)

Steps to Reproduce:

1. Open a file with the following contents:

```
line1
line2
line3
```
2. Place one empty cursor at the start of each of the three lines.
3. Copy.
4. Open a new empty file with a single cursor and paste.

Expected:

```
line1
line2
line3
```

Actual:

```
line1

line2

line3
```

Notes:

- This appears to be a regression introduced in 1.108.0.
- Reproduced by comparing versions directly: 1.107.x is OK, 1.108.0 and later are not.
- It still reproduces in 1.127.0.
- This looks related to the fix for #256039, but it is a different regression from #286892.
- The likely cause is that multiple empty selections now produce `multicursorText` entries that already include trailing newlines, and the plain text clipboard payload then joins those entries with another newline, producing blank lines when pasted into a single cursor.

Potential source locations:

- `src/vs/editor/common/viewModel/viewModelImpl.ts`
- `src/vs/editor/browser/controller/editContext/clipboardUtils.ts`

Suspected introducing commit:

- `20e65fd2ff3753918d34968d260b5ed1a071980d` (`fix copy with multiple cursors and empty selections`)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.