#1007 Selection enhancements (patch included)


I have made a few enhancements that I would love to see included. Basically I upgraded the rectangular selection mode so it can be used the same way as in Visual Studio which I am used to. It is now possible to switch to rectangular mode by pressing the Alt key when a selection is in progress (with the mouse, it already worked with the keyboard). Another enhancement is that rectangular mode is sticky (selection stays in rectangular mode even if Alt is being released). Since this one is up to personal preference and I don't want to break anything, I made it an option and left it off by default.

To allow the mode switch for mouse selections, I extended Editor::ButtonMove() to have the same parameters as ButtonDown(). I extended ButtonUp() as well for consistency, although I didn't use the other modifier keys in there. I implemented the necessary changes for all platforms, but could test only Win32 myself, so a quick functionality check on the other platforms is still needed.

There are now two new functions in Scintilla.iface to set and get the new option. I based them on the multiple selection option and gave them new ids following the previous largest 2xxx value, so it should be correct. But I didn't generate Scintilla.h (don't know how right now), instead I added them there manually. So a quick check if everything is correct is still needed.

While making and testing these changes, I came across a previously existing bug with switching to rectangular selection mode. To reproduce, copy this text into an editor and follow the steps...


  • place the cursor before the A
  • press Shift and go to before B with stream selection
  • then press Alt (keep Shift pressed) and go up to switch to rectangular selection

The line containing the B was not updated, part of the old selection remains. It is just a drawing issue, the line didn't get invalidated for drawing because the +1 in Editor::InvalidateSelection() didn't reach the lower line. When moving the cursor into or below that line or resizing the window, it gets updated. Maybe that doesn't happen on all platforms, but for me (Windows 7 x64) it does. The fix for that problem is included in the patch, that is what the additional InvalidateSelection() in Editor::MovePositionTo() is for.

2 Attachments


<< < 1 2 (Page 2 of 2)
  • Neomi

    Neomi - 2013-08-14

    On one hand, this changes the default behavior when done without a previously activated option. On the other hand, pressing Alt while selecting with the mouse has done nothing so far, so changing this would break nothing. Unless of course somebody presses Alt for any reason and expects that nothing happens.

    Here is one more version of the patches, stripped down to your minimized approach plus the option (and documentation) in case you prefer to have it. I am happy with both versions.

  • Neil Hodgson

    Neil Hodgson - 2013-08-31
    • status: open --> closed
    • assigned_to: Neil Hodgson
<< < 1 2 (Page 2 of 2)

Log in to post a comment.