Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
athompson673 opened this issue Feb 9, 2025 · 1 comment

Comments

@athompson673
Copy link
Contributor

athompson673 commented Feb 9, 2025

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.

@dalthviz
Copy link
Member

Hi @athompson673 thanks for opening this issue and your prompt response to the multicursor implementation feedback over #2112 ! From my side seems like the current implementation is okay but maybe doing some investigation about how other editors/IDEs do the multicursor pasting besides VSCode and Spyder could be worthy (in that way we could see if there is some sort of convention in regards to how the multicursor paste should work) 🤔

Also, from a quick check, seems like on VSCode they have an option to config the multicursor pasting but only to cover the case where the lines to be pasted are equal to the number of cursors available (depending on that option you get to paste the full clipboard in each line or just match one line per cursor):

Image

What do you think this @spyder-ide/core-developers ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants