R – Disabling single line copy in Visual Studio

keyboard shortcutsvisual studiovisual-studio-2008

Is there anyway to disable the rather annoying feature that Visual Studio (2008 in my case) has of copying the line (with text on it) the cursor is on when CTRLC is pressed and no selection is made?

I know of the option to disable copying blank lines. But this is driving me crazy as well.

ETA: I'm not looking to customize the keyboard shortcut.

ETA-II: I am NOT looking for "Tools->Options->Text Editor->All Languages->Apply cut or copy to blank lines…".

Best Answer

If you aren't willing to customize the keyboard settings, then Ctrl+C will always be Edit.Copy, which will copy the current line if nothing is selected. If you aren't willing to use the tools VS provides to customize the interface, then you can't do it.

However, the following works: Assign this macro to Ctrl+C:

Sub CopyOnlyIfSelection()
    Dim s As String = DTE.ActiveDocument.Selection.Text
    Dim n As Integer = Len(s)
    If n > 0 Then
        DTE.ActiveDocument.Selection.Copy()
    End If
End Sub