Box Selection and Multi-Line Editing

Box Selection and Multi-Line Editing

Rate This
  • Comments 16

clip_image002I’m Brittany, a Program Manager on the Visual Studio Editor team.  Some of you may recognize me from Connect bugs, @VSEditor on Twitter, or the Visual Studio Editor blog, which has recently moved to its new home here at The Visual Studio Blog.  I’m responsible for a variety of Editor features, but most recently I designed the new-for-VS 2010 multi-line editing functionality in this post and video.

Box selection is back and better than ever for Visual Studio 2010 Beta2!  You can of course make, copy/paste, drag/drop, and delete box selections, just as in VS 2008.  But that’s not all.  For the first time, you can also 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):

We’ve also made a few changes to box selection that didn’t quite make it into Beta2:

  • In Beta2, indenting a box selection will indent the entire lines containing that box selection.  We have since changed it to indent only the box-selected text, which matches VS 2008 behavior.
  • In Beta2, pasting a box selection on a blank line will interleave the box-selected text with existing text.  We have since changed it to paste the box selection with newlines instead of interleaving, which matches VS 2008 behavior.

This is box selection’s first appearance in VS 2010 and multi-line editing’s Visual Studio debut, so we’d love to hear your feedback!  You can use any of several ways to share your thoughts, either about box selection or regarding other aspects of the Beta2 editor experience:

Whichever method you choose, I hope you’ll let us know what you think!

Brittany Behrens
Program Manager, Visual Studio Editor Team

Leave a Comment
  • Please add 5 and 5 and type the answer here:
  • Post
  • That looks great!  I've always liked the way that VS multi-line indents selections with tab, as opposed to, say notepad which deletes the text altogether.  It helps a lot with regular formatting of source code.  I've always wanted block editing like this though.

    Currently using 2010 Beta 2 and liking it a lot.

  • Is there a way to enter column select mode, which allows extending the selection using unmodified arrow keys, as in Visual Studio 6?

  • I'm really happy to see the first VS 2010 release with Box Selection.  I'm currently using VS 2010 Beta2 as my primary IDE - it rocks!

  • I'm glad to see this. I currently switch to Crimson Editor whenever I need this functionality. Now I can stay in Visual Studio more frequently. If only VS would record and replay keyboard macros, plus have a built-in expression evaluator to use in those keyboard macros, and I could avoid switching to Crimson Editor completely when working on VS supported languages.

  • @GregM:

    No.  We decided against a "column select mode" because of time constraints and design considerations with the new multi-line editing.  For example, while in such a mode, should arrow keys always extend the selection?  What if you have a zero-width box selection - wouldn't it often be more useful for arrow keys to move that selection instead of extending it?  How would we distinguish between the two use cases?  Given the limited time to design and implement this feature between Beta1 & Beta2 and the fact that there hasn't been a column/box selection mode in several product versions, we did not implement such a mode for VS 2010.

    @Phil:

    We're glad you like it!  Regarding macros, Visual Studio actually does have the ability to record and replay keyboard macros.  I'd encourage you to take a look at MSDN's pages on macros in VS 2010 at http://msdn.microsoft.com/en-us/library/b4c73967(VS.100).aspx.

    Brittany Behrens, Program Manager, VS Platform - Editor

  • "For example, while in such a mode, should arrow keys always extend the selection?  What if you have a zero-width box selection - wouldn't it often be more useful for arrow keys to move that selection instead of extending it?  How would we distinguish between the two use cases?"

    Unmodified arrow keys currently clear the selection.  Are you talking about some new functionality that you might add in the future?

    "the fact that there hasn't been a column/box selection mode in several product versions"

    Yes, I know.  After having used it for many years, I've been asking for it to be returned since probably the first day that I used VS2003.

  • This looks really cool and great, it looks fantastic

  • @GregM:

    Regarding unmodified arrow keys, I was posing hypothetical questions about what expected behavior would be if we added/brought back a column selection mode where unmodified arrow keys do not clear a column selection.  The point was to show how the addition of multi-line editing complicates the design of such a mode and how the VS6 behavior might be a bit less intuitive now that we have multi-line editing.  I didn't mean to imply that we're adding new functionality at this point - we've made a few bug fixes for box selection since Beta2, but there will be no major functionality changes for this feature between VS 2010 Beta2 and RTM.

    - Brittany

  • Very neat.

    For the 'future versions wishlist': it would be really cool if you could extend this to also support assymetrical selection from multiple lines. I.e. hold down "alt+shift" or something and drag-and-select text from multiple lines that are not necessarily in the same columns in the text. Even skipping lines in-between.

  • The video doesn't display in Firefox - only in IE.

    Please fix ASAP. In Firefox we can just hear the sound!!!

  • @mcp111: works fine in Firefox for me.

  • This is awesome! Fantastic job VS TEAM (Y) I think the migration to WPF must have enabled VS team to do a lot more :) I have worked on WPF and its really flexible :)

    Good Work

  • How do you move the insertion point inside the selection?  Everything I've tried just clears the selection.

  • It seems like certain characters like semicolon and curly brace end the selection and can cause you to start overwriting data.   Are there other characters that will cause this?

  • @James:  It's possible to swap the anchor (usually start) point and active (insertion) point of your selection using the Edit.SwapAnchor command.  Its keyboard shortcut will vary by profile, but for the general profile it's Ctrl+K, Ctrl+A.  However, there isn't a way to move the insertion point to an arbitrary point within the selection.

    @Nick:  The behavior you mention has been fixed since this demo video was posted.  It was a side effect of auto-formatting on certain characters.  For VS 2010 RTM, we've made auto-formatting less aggressive when there's an active box selection to avoid exactly the problem you describe.

    - Brittany

Page 1 of 2 (16 items) 12