Menu

#2064 SCI_SETSELECTION doesn't trigger SC_UPDATE_SELECTION

Bug
closed-duplicate
nobody
5
2019-12-07
2018-11-24
No

I'm using Scintilla 4.1, on Windows. I discovered that SCI_SETSELECTION doesn't send SC_UPDATE_SELECTION event. I see that Editor.cxx, line 8021:

case SCI_CLEARSELECTIONS:
    sel.Clear();
    ContainerNeedsUpdate(SC_UPDATE_SELECTION);
    Redraw();
    break;

case SCI_SETSELECTION:
    sel.SetSelection(SelectionRange(static_cast<Sci::Position>(wParam), lParam));
    Redraw();
    break;

case SCI_ADDSELECTION:
    sel.AddSelection(SelectionRange(static_cast<Sci::Position>(wParam), lParam));
    ContainerNeedsUpdate(SC_UPDATE_SELECTION);
    Redraw();
    break;

Should SCI_SETSELECTION also call ContainerNeedsUpdate(SC_UPDATE_SELECTION) as others?

Discussion

  • Neil Hodgson

    Neil Hodgson - 2018-11-25
    • status: open --> open-duplicate
     
  • Neil Hodgson

    Neil Hodgson - 2018-11-25

    Duplicate of [#1723].

     

    Related

    Bugs: #1723

  • Yusuf Ramazan Karagöz

    In duplicate;

    I've observed that the SCN_UPDATEUI notification doesn't fire when using the SCI_SETSELECTION, SCI_ADDSELECTION,

    But right now, SCI_ADDSELECTION raises SC_UPDATE_SELECTION, but SCI_SET_SELECTION do not. I can understand it if it's not a bug. But all those API's behave not same for firing or not, and in the documentation i can not find any thing about, which fires an update event, and which not. Should APIs not listed under SC_UPDATE_SELECTION-Documentation, that fires this event?

     
    • Neil Hodgson

      Neil Hodgson - 2018-11-26

      I do not think it is worth the effort to change and maintain the documentation.

       
      • Yusuf Ramazan Karagöz

        Then it will be enough to update documentation to list APIs that fires SC_UPDATE_X-Events. As i can see, is SCI_ADDSELECTION the only API that doesn't sends SC_UPDATE_SELECTION or is there any others? I'm calling now SCI_SETMAINSELECTION(0) after SCI_SETSELECTION to have Update-Events. Is this call the lowest cost way to have an update event or is there any other elegant way to do it? Thank you.

         
  • Neil Hodgson

    Neil Hodgson - 2019-12-07
    • status: open-duplicate --> closed-duplicate
     

Log in to post a comment.

MongoDB Logo MongoDB