Visual Studio keyboard shortcut discussion: why Edit.DeleteLine is different from Edit.Cut

Posted: (EET/GMT+2)

 

I while ago, I was giving a training course to Visual Studio developers, and among other things I showed them several code editor tips. One of them was the keyboard shortcut to delete a line, which is Ctrl+Shift+L. I received critique that this shortcut is way too complex, and that Shift+Del would be much simpler.

However, these two keyboard shortcuts are not the same. Shift+Del maps to editor command Edit.Cut, which is the same as the more commonly known Ctrl+X. That is, it cuts the current line to the clipboard. If there is no selection, the current editor line is placed in the clipboard. On the other hand, the shortcut Ctrl+Shift+L maps to Edit.DeleteLine.

So yes, these two commands can look the same, but they are different in an important way: Edit.DeleteLine doesn't alter the contents of the clipboard.