The new Box Selection, now with Multi-Line Editing!


Since VS 2010 Beta1 became publicly available last week, the Editor team has heard from quite a few users who miss box selection (aka column selection, block selection, or rectangular selection).  Yes, it’s missing from the beta, but the good news is that it will be back and better than ever for the final release of VS 2010.


Not only will you be able to make, copy/paste, drag/drop, and delete box selections, but you’ll also have the new ability to insert and edit text on multiple lines.  Check out this video we’ve created to demo the new Box Selection and Multi-Line Editing functionality (this demo has video and audio, so plug in your headphones or turn up the sound):


Comments (14)

  1. Martin Filteau says:

    This is fantastic!!!  Keep up the good work!

  2. AaronM says:

    Great demo video Brittney. The new multi-line insertion/edit is an awesome feature!

  3. Schneider1 says:

    Awesome.

    Was adding this feature made any easier by the new architecture of the editor?

    I am wondering if the VS team are already seeing the benefits of the investment n the new architecture in terms of delivering features quicker to customers. Maybe a blog post about the ROI on WPF is in order 🙂

  4. Ivan B says:

    I’m glad to hear that my favorite feature is making its way back into the Editor!

    The multi-line edit is a great improvement to box selection, making the whole experience feel more complete and thought-out.  I wished that this was in Beta1 3 different times today alone… I hope we will see it soon!

  5. @Schneider1:

    Yes, but it didn’t really have anything to do with WPF (drawing the selection is one of the simplest parts); it was fairly simple (technically) due to:

    1) The rich set of primitives at the data (text) model

    2) The architectural separation between various pieces of the editor

    3) General niceties from managed code and more specific things like Linq

    -Noah

  6. VSEditor says:

    For those who don’t know (and how would you, really?):  noahric is the developer who implemented Box Selection and Multi-Line Editing, so he definitely knows what he’s talking about 🙂  Thanks for making this possible, Noah!

    Schneider1 – Stay tuned.  We have a post in the works on the Editor’s text model and architecture, which should answer your question about the benefits of rebuilding the Editor.  Watch for a post on this in the next 2-3 weeks.

    – Brittany

  7. Slow start, eh? I haven’t written a post in here since I started this blog, as I’ve been a bit, uh, distracted

  8. wyck says:

    I think you should have demonstrated that you can search and replace with scope limited to the box selection.  If you had kept your box-selection, and done a search and replace of ";" (a semicolon) with "" (empty text), then you could have deleted all the semicolons in your box selection in a single step without all the work of repositioning the cursor.  But otherwise, good job!

  9. VSEditor says:

    wyck –

    Good point 🙂  What you described (keep the box selection, then do a replace-all of ";" with "") would work perfectly for this scenario.  Wish I had thought of it sooner!

    – Brittany

  10. Pleasant surprise from Microsoft

  11. GregM says:

    Very nice.  Now, tell me that you’ve also fixed connect ID 139752 at the same time, and restored the function for entering and exiting column select mode so you can then use unmodified arrow keys without losing your selection, and you’ll have made my year.

  12. Sam says:

    One key issue with rectangular selection in earlier versions of Visual Studio was incorrect placement of the cursor following a rectangular block paste. The correct location for the cursor is one character below the bottom left corner of the pasted block, in virtual space if no character is present there. I believe this mistake is one of the primary reasons rectangular selection never really "took off."

    I’ve been using an add-in I wrote years ago to make block paste useful in VS05 and 08, but it suffers from two problems:

    1. It doesn’t place the cursor at the correct position in virtual space when no real character exists below the bottom left character of the pasted region.

    2. In doesn’t properly handle collapsed code regions.

    One more thing: if you do a standard copy of part of one line (no newline is part of the copied text), and then make a rectangular selection before pasting, maybe the copied text should be inserted on every line of the selected region?

  13. GregM says:

    "One key issue with rectangular selection in earlier versions of Visual Studio was incorrect placement of the cursor following a rectangular block paste. The correct location for the cursor is one character below the bottom left corner of the pasted block, in virtual space if no character is present there. "

    I had never thought about placing it below the selection, but now that you mention it, it does sound like it would be useful in some situations.  However, it’s definitely not useful in others.  For example, this would prevent you from pasting a column of spaces multiple times to add some whitespace for alignment, but I suppose that’s no longer necessary with the new capability of typing into a region.

    What’s even worse is that the paste behavior changed between VC6 and 2003 (never used 2002).

    In VC6, the caret location would always remain unchanged followed by a block paste.  This allowed block selecting a word, pasting it, and then pressing the down arrow and pasting it again to place it in the same position in the next line.

    By VS2003, it had changed such that for a block paste of two or more lines, the caret position remains unchanged, while for a block paste of one line, the caret is placed at the end of the paste, just like for a regular paste.  This eliminated the ability to do the operation I described above.

    The real big loss was definitely the ability to enter box selection mode.  It doubled the number of navigation functions needed. Now instead of just CharRightExtend, CharLeftExtend, WordRightExtend, WordLeftExtend, LineStartExtend, LineEndExtend, LineDownExtend and LineUpExtend we need to also have CharRightExtendColumn, CharLeftExtendColumn, WordRightExtendColumn, WordLeftExtendColumn, LineStartExtendColumn, LineEndExtendColumn, LineDownExtendColumn, and LineUpExtendColumn.  It’s hard enough to type Ctrl+Shift+Down several times, but Ctrl+Shift+Alt+Down is a heck of a lot worse.

Skip to main content