Click here to Skip to main content
15,878,959 members
Articles / Visual Studio
Tip/Trick

Prevent Cutting or Copying Blank Lines in Visual Studio

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
28 Jun 2012CPOL 13K   1   5
How to prevent cutting or copying blank lines in Visual Studio

Introduction

I hope you know that we are not required to select a line to cut or copy it in Visual Studio, you can just keep the caret in a line and press Ctrl + C or Ctrl + X and the text in the line will be copied to your clipboard and you can insert this line anywhere in your code by pressing Ctrl + V.

It will also copy a blank line, but people use Ctrl + X command to delete blank lines and some may find this as an issue as they didn’t intend to copy the blank line and also it will clear the previously copied item in the clipboard.

It is surprising as usual to find that Visual Studio team has thought this out and provided a setting which prevents the copying of blank lines, and Cut command will just delete the blank lines.

I found this when I recently bumped into the setting in Visual Studio, in Text Editor > All Languages called "Apply Cut or Copy commands to blank lines when there is no selection".

preventblanklinecopying

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
India India
I am Ashoka (Ashoka.R.K.T.), I am a software professional who is passionate about designing and developing great applications. I blog at https://ashokaon.tech, I will be writing about all things technology and coding.

Comments and Discussions

 
QuestionCtrl+J Pin
aSarafian28-Jun-12 20:34
aSarafian28-Jun-12 20:34 
AnswerRe: Ctrl+J Pin
Ashoka RKT29-Jun-12 2:11
professionalAshoka RKT29-Jun-12 2:11 
GeneralRe: Ctrl+J Pin
aSarafian29-Jun-12 2:30
aSarafian29-Jun-12 2:30 
GeneralAlternative Pin
perilbrain28-Jun-12 5:44
perilbrain28-Jun-12 5:44 
GeneralRe: Alternative Pin
Ashoka RKT28-Jun-12 6:11
professionalAshoka RKT28-Jun-12 6:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.