#50 How not to accidentally copy a blank line in Visual Studio
Thursday, February 19 2009
We all use CTRL+C and CTRL+V everyday, 1000 times. It's one of the first things you have to learn as a programmer to keep you hands on the keyboard. It's easy to sometimes press CTRL+C again, when in fact it's time to Paste, so you really meant to press CTRL+V. Visual Studio will allow you to copy a blank line. So it what you're trying to paste, is onto a new blank line, and you accidentally press CTRL+C, you'll copy the blank line, then your CTRL+V is lost. (Oh but tip #51 Shows you the clipboard ring). Anyway - this tip tells Studio to not copy blank lines.
This work is licensed under a Creative Commons license.
Visual Studio Tip / Trick #050 English Transcription:
Today's Visual Studio Trick of the day, trick no. 50 was originally recorded by Sara Ford in September 2007.
The trick is copy paste on a blank line. So if you have some text copied on your clip board, [CTRL]+[C] and you go down to a blank line and accidentally press [CTRL]+[C] again, now if you try to paste, you are gonna paste that blank line. Now we know that [CTRL]+[SHIFT]+[V] to get through our clipboard ring. Or we can go to Tools -> Options and under Text Editor -> All Languages, there's an option here that says "Apply Cut or Copy commands to blank lines when there is no selection". And if you turn that off, now you can [CTRL]+[C] on a blank line and that won't take affect because you have that option turned off. I have confirmed that works the same in Visual Studio 2008 as in 2005. Works the same in both versions.
2 comment(s) so far
Thank you very much for this tip! I've always hated that visual studio copies blank lines, I'm turning that option off right now!