As mentioned in a previous post, we have been working on refactoring the core internal implementation of our SyntaxEditor code editor control on the WPF, UWP, and WinForms platforms. This effort (codenamed vNext) is being made to bring all three platforms onto the same codebase for easier updating moving forward, and to enhance features wherever possible.
As described in recent blog posts, we've been working on adding multiple caret/selection support to SyntaxEditor in vNext. In this post, I'd like to show off a neat new feature related to copying/pasting text when there are multiple selections.
At the start of this animation, I do a line copy, which occurs when there is no selection and you press Ctrl+C. Then I paste that line in three times.
Next I select the text "Actipro," then Ctrl+select the text "SyntaxEditor," and finally Ctrl+select the text "vNext." The Ctrl+selections have allowed me to create three selections. At this point I could type and it would replace each of those selections with what I typed. Instead, I'm going to press Ctrl+C again to copy the selected text.
When I copy multiple selections, each selection's text is appended together and delimited by a line terminator. So if you would paste what I copied into Notepad, it would paste as:
In the animation, the next thing I do is put a caret in each of the three empty strings by Ctrl+clicking in them. We just added some new vNext logic that will compare the number of selections with the number of lines in the pasted text. When they are equal, as they are in this demo, each line in the pasted text will get pasted into the related selection. The end result is you can see how each of the three selections I originally copied end up in a separate target selection.
Multiple caret/selection support touches many portions of the editor and we are continuing to work through updating all feature areas to support it.
Let us know what you think in the comments.