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 is being made to bring all three platforms onto the same codebase for easier updating moving forward, and to enhance features wherever possible.
As we continue development of SyntaxEditor vNext, we are getting into porting in the caret/selection feature area. We've seen a couple newer editors support the concept of multiple carets/selections and would like to get some feedback on if this is a desired feature by our customers. This is different than the rectangular box selection feature we currently already support.
Rectangular Box Selection
Rectangular box selection is already supported in SyntaxEditor and looks like this:
When this selection is active, you can type and it will enter text at the same column on each line. You can also copy box-selected text and when it's pasted, it will retain the box layout. This is a very handy and powerful feature.
Now what happens if you want to make multiple updates but not necessarily in the same column. Let's take a look at a scenario:
In the screenshot above, the caret is next to a Write method call. Let's say we want to update all the Write method calls to be WriteLine instead. We could change it once and copy/paste it to the other locations. But if we had multiple caret support, you could throw a caret at the end of each of the four Write method calls (in various columns) and simply type Line to update all of them.
One implementation of this I saw used Alt+Click to add carets. I don't personally like this because Alt is used as a system menu accelerator and causes issues like underlines to appear in menus if you Alt+Click.
Another implementation of this used Ctrl+Click to add carets. That seems better since it won't run into the system menu accelerator issue. The downside is that Ctrl+Click is currently used in SyntaxEditor (and Visual Studio's code editor) to do quick word selection. Thus we'd need to rework some of our existing keyboard shortcuts to accommodate new features.
Both these implementations also use Ctrl+U as a way to undo the last selection change, whereas SyntaxEditor and VS currently tie that keyboard shortcut to making selected text lowercase.
Let's hear from you… is the multiple caret/selection feature something you'd like to see? How would you prefer to see the keyboard shortcuts adjusted to accommodate new features?