萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> 編程語言綜合 >> Visual Studio 2012中Ctrl-C是什麼?

Visual Studio 2012中Ctrl-C是什麼?

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

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

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

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

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

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

  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 2012中Ctrl-C是什麼? 三聯

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

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

copyright © 萬盛學電腦網 all rights reserved