Disabling copy of empty text in Visual Studio

Visual StudioKeyboard

Visual Studio Problem Overview


I have somehow misconfigured fingers. This leads to a very annoying situation.

  1. I select a block of text to copy;
  2. I move the cursor the place where I want to paste the code;
  3. I accidentally press Ctrl+C again instead of Ctrl+V;
  4. My block of copied text is replaced by an empty block;
  5. I have to go back and do it all over again. Grrrrr.

Is there any way to disable this behavior, that is to disable copy of empty blocks of text in Visual Studio 2005+?

Visual Studio Solutions


Solution 1 - Visual Studio

It's not copying an empty block, it's copying the blank line. You can change this setting in Tools > Options > Text Editor > All Languages > 'Apply Cut or Copy Commands to blank lines when there is no selection'

Solution 2 - Visual Studio

Press CTRL+SHIFT+V twice.

Solution 3 - Visual Studio

I'm using Visual Studio 2008 (but I believe this answer applies to Visual Studio 2005).

Select Tools -> Options.

Navigate to the "Text Editor" node and expand it.

Expand "All Languages" (or whatever language you want to apply this to) and check the "Apply Cut or Copy commands to blank lines when there is no selection".

Solution 4 - Visual Studio

> The option that saved my sanity is found in Tools - Options - Text Editor - All Languages - General. There's a checkbox Apply Cut or Copy commands to blank lines when there is no selection. Unchecking this allowed me to hit Ctrl+C all i want on a blank line without losing the content on my clipboard.

Source

Solution 5 - Visual Studio

Go to Tools > Options > Text Editor > All Languages > General

The option on that page is "Apply Cut or Copy commands to blank lines when there is no selection"

Solution 6 - Visual Studio

For some reason that option didn't work for me (VS2010)

The answer mentioned here where you assign Ctrl+C to the macro worked however https://stackoverflow.com/questions/108094/disabling-single-line-copy-in-visual-studio

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJorge FerreiraView Question on Stackoverflow
Solution 1 - Visual StudioJohn SheehanView Answer on Stackoverflow
Solution 2 - Visual StudioMagnus JohanssonView Answer on Stackoverflow
Solution 3 - Visual StudioJeremy WiebeView Answer on Stackoverflow
Solution 4 - Visual StudioEndangeredMassaView Answer on Stackoverflow
Solution 5 - Visual StudiodcstrawView Answer on Stackoverflow
Solution 6 - Visual StudioFearlessHyenaView Answer on Stackoverflow