Visual Studio 2012中Ctrl-C會複製空行清空剪貼簿

來源:互聯網
上載者:User

這個問題容易出現的情境如下:

Ctrl-C 複製一段代碼(Ctrl-X也是同樣的問題)

游標移至想要粘貼代碼的空行位置(一般都是在空行上粘貼)

按下 Ctrl 鍵,在接著準備按 V 鍵時,一走神或者手一抖,手指落在了 C 鍵上。

你回過神來一看,什麼也沒粘貼出來,只是游標下移一行。

你以為沒按上鍵,然後又連續多次Ctrl-V,只見游標依次下移一行,依然什麼也沒有。

這時,如果你知道 Shift-Ctrl-V  (cycle clipboard ring) 這個快速鍵,可能不會怎麼惱火,按兩下 Shift-Ctrl-V 就能解決問題;但是如果你不知道這個快速鍵,你會很惱火,只能重新複製;如果是剪下,你的惱火會加倍。

2011年7月,有人在微軟的 visualstudio.uservoice.com 網站上反饋過這個問題:

stop processing Ctrl+C on empty selections

更多精彩內容:http://www.bianceng.cnhttp://www.bianceng.cn/Programming/net/

After copying a large chunk of text to the clipboard with Ctrl+C, I move the cursor to the correct spot in another file and paste it with Ctrl+V. Oh wait, except instead of Ctrl+V my fingers hit Ctrl+C. Even though I didn't highlight any new text, the editor threw my entire careful clipboard in the garbage and replaced it with the current line, forcing me to go back to the other file which I might have closed by now. This is an EXTREME pain in the backside, something I can't turn off (the existing setting only claims to work on blank lines, and doesn't even get THAT right), and something that Visual C++ never used to do before Visual Studio .NET or whatever you call this. Will I have to write an extension that stops the editor from mindlessly performing the copy hotkey on any text that isn't even selected?

微軟對這個反饋沒有置之不理,在 VS2012 中提供解決了方法(在 stackoverflow 上找到的):

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'.

解決方案很簡單,只需取消'Apply Cut or Copy Commands to blank lines when there is no selection'的選擇。

雖然不能理解為什麼會有複製空行的需求,但如果有,是可以接受的。

但是,為什麼預設設定為複製空行,這有違大家的日常操作習慣。在我使用過的編輯器中,除了 Visual Studio,還沒遇到會複製空行的編輯器,即使是 Windows 內建的記事本也不會這麼做。這個實在無法理解!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.