Menu

#931 Ctrl+double click to add the word to multiple selection

Completed
closed
Scintilla (391)
5
2012-06-01
2012-04-21
nofun
No

If would be helpful if double click with Ctrl pressed would not cancel selection present but would instead add the word clicked to multiple selection.

Discussion

  • Neil Hodgson

    Neil Hodgson - 2012-04-21
    • assigned_to: nobody --> nyamatongwe
    • labels: --> Scintilla
     
  • Neil Hodgson

    Neil Hodgson - 2012-04-21

    The following patch does this but I haven't tested it thoroughly:

    @@ -6233,7 +6233,8 @@
    if (((curTime - lastClickTime) < Platform::DoubleClickTime()) && Close(pt, lastClick)) {
    //Platform::DebugPrintf("Double click %d %d = %d\n", curTime, lastClickTime, curTime - lastClickTime);
    SetMouseCapture(true);
    - SetEmptySelection(newPos.Position());
    + if (!ctrl)
    + SetEmptySelection(newPos.Position());
    bool doubleClick = false;
    // Stop mouse button bounce changing selection type
    if (!Platform::MouseButtonBounce() || curTime != lastClickTime) {

     
  • Neil Hodgson

    Neil Hodgson - 2012-04-23
    • milestone: --> Completed
     
  • Neil Hodgson

    Neil Hodgson - 2012-04-23

    Committed change.

     
  • Marko Njezic

    Marko Njezic - 2012-04-23

    This change has introduced random behavior when clicking multiple times while holding CTRL key. Transition from line selection to character selection doesn't work properly anymore.

    You also forgot to reference this bug in Hg history when you made the change.

     
  • Neil Hodgson

    Neil Hodgson - 2012-04-23

    Updated so transition from line selection back to character selection should work OK.

     
  • Marko Njezic

    Marko Njezic - 2012-04-23

    The update has removed the ability to use ctrl+triple click to select multiple lines, which was possible using the original modification. While ctrl+triple click was not part of the original request, it is actually a useful addition and can even be a nice alternative to the feature request #3520035.

     
  • Marko Njezic

    Marko Njezic - 2012-04-23

    I forgot to mention that you should also add a check for multipleSelection to the if condition, just to be entirely correct and avoid surprises:

    if (!ctrl || !multipleSelection || (selectionType != selChar && selectionType != selWord))
    SetEmptySelection(newPos.Position());

     
  • Neil Hodgson

    Neil Hodgson - 2012-04-23

    Committed.

     
  • Marko Njezic

    Marko Njezic - 2012-04-27

    Unfortunately, the one line change that was used to implement this feature is not enough and must be reverted until a proper implementation is made. With this change it is possible to make multiple selections that can overlap, but Scintilla can't cope with situations when a single character belongs to multiple selections. This can lead to unpredictable behavior when you start typing to overwrite such selections (the same character will be added multiple times, instead of only once).

    More details about the problem can be found in Neil's comment on bug #294563: https://sourceforge.net/tracker/?func=detail&aid=2945631&group_id=2439&atid=102439

     
  • Neil Hodgson

    Neil Hodgson - 2012-04-28

    Selection simplification is handled in other circumstances by the TrimSelection method which is invoked by tentative selection handling. This isn't tentative but could still use TrimSelection or AddSelection.

     
  • Marko Njezic

    Marko Njezic - 2012-04-28

    It isn't that simple, as you have to adjust selections on the fly when you're in drag selection mode. Handling this properly would require modifications in both ButtonMove and ButtonUp methods. Not to mention possible corner cases that can arise during implementation. Good luck.

     
  • Neil Hodgson

    Neil Hodgson - 2012-05-08

    Committed changes to trim selection when performing word or line selection.

     
  • Neil Hodgson

    Neil Hodgson - 2012-06-01
    • status: open --> closed
     

Log in to post a comment.