2014-11-09

IntelliJ IDEA feature request: editor actions for moving the caret left & right with Column Selection.

I just submitted a feature request for IntelliJ IDEA.

It can be found here: https://youtrack.jetbrains.com/issue/IDEA-132626

Feature request: editor actions for moving the caret left & right with Column Selection.


It is a fundamental axiom of user interface design that modes kill usability. Having to enter a special mode in order to accomplish something and then having to remember to exit that mode in order to accomplish anything else is bad, bad, bad user interface design, at least when there is even a slight chance that the same thing could be achieved without a special mode. (Think of VI for example: it is the lamest editor ever, and almost all of its lameness is due to the fact that it relies so heavily on modes.)

Unfortunately, programmers tend to think a lot in terms of modes, so the first time the user of an editor asked the programmer of that editor for the ability to do block selection ("column selection" in IntelliJ IDEA parlance) the programmer said "sure, I will add a new mode for this." That's how problems start.



Then of course users start complaining about this, because all they wanted was the ability to select columns, not a special column selection mode, so what ends up happening is that programmers start adding workarounds. Recently you added the ability to do column selection with Alt + Mouse Drag without the need to manually enter column selection mode first. This is not only especially useful for all of us who come from a Microsoft Visual Studio background, but it also makes sense for everyone, because it does away with a despised mode. At least when working with the mouse.

Unfortunately, you have not extended the same goodness to selection with keyboard arrow keys, which is pretty bad in light of the fact that expert users tend to stick with the keyboard and rarely touch the mouse, so column selection mode is still being forced upon them.

The way to solve this is as follows: you already have four editor actions for moving the caret while extending the selection depending on the current state of the column selection mode: "Left with Selection", "Right with Selection", "Up with Selection", and "Down with Selection". That's all very fine and dandy, and you do not need to change anything there, so as not to break it for all those poor people who have resigned to having to use a special mode for column selection and would freak out if that mode was taken away from them.

What you need to do is add four more editor actions for moving the caret while extending the column selection: "Left with Column Selection", "Right with Column Selection", "Up with Column Selection", and "Down with Column Selection". (I would bind them to Alt+Shift+Left Arrow, Alt+Shift+Right Arrow, Alt+Shift+Up Arrow, and Alt+Shift+Down Arrow respectively, as Visual Studio does.)

These actions should probably work as follows: if column selection is enabled, they should just work as the existing actions. If column selection is not enabled, then they should enable it, move the caret while extending the column selection, and then set a special flag to clear the column selection mode if any non-selection-extending key is pressed. This way, people will be finally free from the tyranny of column selection mode.

(By the way, you probably should make Alt + Mouse Drag also set that special 'cancel column selection' flag, so that it does not leave the editor in column selection mode if the editor was not already in column selection mode when the Alt + mouse drag started.)

Thank you very much in advance.

No comments:

Post a Comment