Skip to content

Multi-Cursor paste does not paste entire clipboard, or pastes nothing for some cursors #23691

@athompson673

Description

@athompson673

While writing the paste functionality for the multi-cursor addition, I was focused on ensuring it was possible essentially to paste one line each cursor from the clipboard. For handling a mismatch in the number of lines and the number of cursors, I chose to use the smaller of the two either not pasting anything for extra cursors beyond the number of lines in the clipboard, or not pasting all the lines from the clipboard if there are not enough cursors.

I can see some limited examples of wanting that behavior, however it was pointed out that perhaps it should instead fall back to pasting the entire clipboard for each cursor in the case of a mismatch. (VSCode does this, and IMHO is a fine benchmark for implementation)

The implementation is quite simple:

change:

if len(lines) == 1:
            lines = itertools.repeat(lines[0])

to

if len(lines) != len(cursors):
            lines = itertools.repeat(clip_text)

within MultiCursorMixin.multi_cursor_paste

I would like some input however before posting it as a PR.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions