Menu

#2006 Spurious SCN_UPDATEUI notifications during mouse rect selection

Bug
closed-rejected
4
2018-05-14
2018-04-03
No

When Alt+Dragging, there seems to be spurious SCN_UPDATEUI notifications carrying the SC_UPDATE_SELECTION flag.

Steps to reproduce:

  1. Use the mouse and Alt+Drag to make a rectangular selection
  2. While the mouse is moving the SCN_UPDATEUI notifications are generated (this is fine)
  3. While still holding the mouse button down, stop moving the mouse. Scintilla will generate ~5 SCN_UPDATEUI notifications per second.
  4. This does not occur when using Shift+Alt+Arrows

I have reproduce this on Win7 using:

  • Win32 plat using Scintilla v3.5.6 (Notepad++ v7.5.6 32-bit)
  • Qt v5.9.4 using Scintilla v3.8

Discussion

  • Neil Hodgson

    Neil Hodgson - 2018-04-03

    Automatic scrolling while mouse is down is performed on timer ticks as if the user is moving the mouse.

     
    • Justin Dailey

      Justin Dailey - 2018-04-03

      Ah OK. That makes a bit more sense now.

      If you are interested, I've made a minor modification to Editor::ButtonMoveWithModifiers() that appears to fix the issue in a couple of cases I've noticed (rectangular selection and multilpe selections) by checking first the the position has actually changed before the selection gets changed and invalidated.

      I've attached the new Editor::ButtonMoveWithModifiers() method. This was made on the v3.8 release. Guessing it will carry over to v4.0+ fine.

       
  • Neil Hodgson

    Neil Hodgson - 2018-04-03

    SCN_UPDATEUI with SC_UPDATE_SELECTION notifications are meant for updating ancillary UI elements to match the state of Scintilla. A common example is showing the current position in a status bar. This feature was not designed to reflect selection changes accurately. Instead it should be seen as a hint that a change may have occurred. Attempts to use this as meaning that the selection has definitely changed will not work. I will update the documentation to reflect this.

    Eliminating all unnecessary SC_UPDATE_SELECTION notifications appears to me to be difficult and fragile and will increase code complexity.

     
    • Justin Dailey

      Justin Dailey - 2018-04-03

      That explanation is sufficient for me. And updating the documentation will help clarify the intent of the notification. Thanks!

       
  • Neil Hodgson

    Neil Hodgson - 2018-04-04
    • labels: --> scintilla, notification
    • status: open --> open-rejected
    • assigned_to: Neil Hodgson
    • Priority: 5 --> 4
     
  • Neil Hodgson

    Neil Hodgson - 2018-04-04

    Updated the documentation with [3f20ba].

    The code has some poor layering currently. ButtonMoveWithModifiers should just classify the mouse movement and pass up to a SetSelection* method that joins keyboard and mouse (and potentially other) input events into logical events. This is what happens for simple selections but the rectangular and multiple-selection cases add irregular selection manipulation inside ButtonMoveWithModifiers. The SC_UPDATE_SELECTION notification is triggered in InvalidateSelection which is called somewhat liberally for complex selection cases since it is difficult to calculate the exact area that has changed from unselected to selected (or reverse) so needs redrawing.

    It may be possible for the patch to change behaviour for the worse in unusual circumstances, such as background styling, where the text layout is changing asynchronously while the mouse is down. Understanding any problems would take more time and effort than appear justified by the patch's benefits.

    I have marked this issue as 'rejected' as improving this code is low priority.

     

    Related

    Commit: [3f20ba]

  • Neil Hodgson

    Neil Hodgson - 2018-05-14
    • status: open-rejected --> closed-rejected
     

Log in to post a comment.

MongoDB Logo MongoDB