在Visual Studio中禁用单行复制 [英] Disabling single line copy in Visual Studio

查看:86
本文介绍了在Visual Studio中禁用单行复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有必要禁用Visual Studio(在我的情况下为2008)具有的相当烦人的功能,即当 CTRL - C时将光标复制到该行(带有文本) 被按下并且没有选择?

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 CTRL-C 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:我不是要自定义键盘快捷键.

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

ETA-II:我不是在寻找工具->选项->文本编辑器->所有语言->应用剪切或复制到空白行...".

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

推荐答案

如果您不愿意自定义键盘设置,则 Ctrl + C 始终为Edit.Copy,如果未选择任何内容,它将复制当前行.如果您不愿意使用VS提供的工具来自定义界面,那么您将无法使用它.

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.

但是,以下工作原理: 将此宏分配给 Ctrl + C :

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

这篇关于在Visual Studio中禁用单行复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆