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

Prevent copying an empty line by accident #59193

Merged
merged 3 commits into from Nov 12, 2018

Conversation

Projects
None yet
3 participants
@usernamehw
Copy link
Contributor

usernamehw commented Sep 23, 2018

Fixes #55243

@usernamehw usernamehw changed the title Prevent copying an empty string by accident Prevent copying an empty line by accident Sep 23, 2018

@ramya-rao-a ramya-rao-a requested a review from rebornix Sep 24, 2018

@rebornix rebornix added this to the October 2018 milestone Sep 26, 2018

@@ -142,6 +142,13 @@ class ExecCommandCopyAction extends ExecCommandAction {
if (!emptySelectionClipboard && editor.getSelection().isEmpty()) {
return;
}
// prevent copying an empty string by accident
if (editor.getSelections().length === 1 && editor.getSelection().isEmpty()) {

This comment has been minimized.

@rebornix

rebornix Oct 1, 2018

Member

You may want to compare between editor.getModel().getLineFirstNonWhitespaceColumn and editor.getModel().getLineMaxColumn instead of doing a substring.

@rebornix
Copy link
Member

rebornix left a comment

The approach looks good to me. The only comment I have is doing less costly comparison.

@usernamehw

This comment has been minimized.

Copy link
Contributor

usernamehw commented Oct 3, 2018

@joaomoreno joaomoreno modified the milestones: October 2018, November 2018 Nov 8, 2018

@rebornix
Copy link
Member

rebornix left a comment

It looks good to me.

@rebornix rebornix merged commit 0a1eb06 into Microsoft:master Nov 12, 2018

2 checks passed

VS Code #20181003.69 succeeded
Details
license/cla All CLA requirements met.

@usernamehw usernamehw deleted the usernamehw:copy_empty branch Nov 12, 2018

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