If you want to delete the current line or a block of lines in Visual Studio you don’t have to select the line(s) and press DEL. But there’s another possibility you may want to consider:
Use Ctrl+L do delete the current line or all the lines touched by the current selection.
Warnings
Easy as it is, there are two warnings for you:
Warning 1: Ctrl+L is Cut
Actually, Ctrl+L does a cut operation, so it will overwrite the content of your clipboard.
Warning 2: Mind the last line
If you have selected multiple lines and your selection ends with the first column of a line, that line will be deleted as well in its entirety although you may have no visual clue that it is part of the selection!
Especially, when you select your lines by holding the shift key and moving the cursor down, there might be always a line more involved than you might expect:
This will cut the line with the closing brace as well (what you might not want to). Instead, if you just select until the end of the line that will not happen. Mind the length of the selection-rectangle and the position of the caret in contrast to the previous example:
No comments:
Post a Comment