Prevent copying an empty line by accident#59193
Prevent copying an empty line by accident#59193rebornix merged 3 commits intomicrosoft:masterfrom usernamehw:copy_empty
Conversation
| return; | ||
| } | ||
| // prevent copying an empty string by accident | ||
| if (editor.getSelections().length === 1 && editor.getSelection().isEmpty()) { |
There was a problem hiding this comment.
You may want to compare between editor.getModel().getLineFirstNonWhitespaceColumn and editor.getModel().getLineMaxColumn instead of doing a substring.
rebornix
left a comment
There was a problem hiding this comment.
The approach looks good to me. The only comment I have is doing less costly comparison.
|
cc @rebornix |
|
Is this setting configurable? I preferred the old behavior, copy whatever line I press 'Ctrl +c' on regardless of its content. This PR assumes a user didn't want to copy a blank line which I usually do. It seems the real fix is to copy whatever line the user used the keyboard shortcut on and recommend clipboard managers if you copy something that you didn't intend. |
|
FYI, I opened #69903 for this. Ctrl + C (or similar keyboard mappings on other editors like notepad++ or even online editors - like firebase rules editor) make no assumption on intention. Ctrl + C just copies the line. I'm not opposed to inference, but in this case, it seems like it should be configurable and not assumed that copy of a blank line was in error. 😄 |
|
I do not think this is a mistake, on the contrary I think he can improve my efficiency, please return to the original. |
Fixes #55243