Menu

#1187 Scintilla: Updating scrollbars

Committed
closed
5
2017-05-27
2017-05-09
Gintaras Q
No

Need an API to update scrollbars.

    case SCI_UPDATESCROLLBARS:
        SetScrollBars();
        break;

Because now vertical scrollbar becomes incorrect after adding, changing or removing annotations. Updating scrollbars for each added/removed/changed annotation would be slow, but I would update asynchronically, eg using a 10 ms timer.

Discussion

  • Neil Hodgson

    Neil Hodgson - 2017-05-09

    Not changing the scrollbars when annotations are added or removed is a bug. It hasn't been visible is SciTE as other operations performed at the same time (such as defining the annotation styles) caused scrollbars to be updated.

    Could be fixed with

    diff -r 66b002a821f7 src/Editor.cxx
    --- a/src/Editor.cxx    Mon May 08 10:40:59 2017 +1000
    +++ b/src/Editor.cxx    Wed May 10 08:53:27 2017 +1000
    @@ -2638,7 +2638,9 @@
            if (mh.modificationType & SC_MOD_CHANGEANNOTATION) {
                Sci::Line lineDoc = pdoc->LineFromPosition(mh.position);
                if (vs.annotationVisible) {
    -               cs.SetHeight(lineDoc, cs.GetHeight(lineDoc) + mh.annotationLinesAdded);
    +               if (cs.SetHeight(lineDoc, cs.GetHeight(lineDoc) + mh.annotationLinesAdded)) {
    +                   SetScrollBars();
    +               }
                    Redraw();
                }
            }
    

    Asynchronous scroll bar changes may improve performance in this and other situations but it is possible that this would cause bugs with stale scrollbars.

     
  • Neil Hodgson

    Neil Hodgson - 2017-05-09
    • labels: --> scintilla, annotation, scroll
    • assigned_to: Neil Hodgson
     
  • Gintaras Q

    Gintaras Q - 2017-05-10

    I applied the fix. Now SCI_ANNOTATIONSETTEXT works well. Itself it is many times slower now (when annotations are visible), but the async workaround was even slower. No problem. For max speed I can temporarily hide annotations (SCI_ANNOTATIONSETVISIBLE) when there are many annotations to add/remove/modify.

    It seems that SCI_ANNOTATIONSETVISIBLE also has this problem. I added SetScrollBars(); in SetAnnotationVisible and now it works well.

     

    Last edit: Gintaras Q 2017-05-10
  • Neil Hodgson

    Neil Hodgson - 2017-05-10
    • labels: scintilla, annotation, scroll --> scintilla, annotation, scroll, bug
    • Group: Completed --> Committed
     
  • Neil Hodgson

    Neil Hodgson - 2017-05-10

    Committed a fix as [61adfb].

     

    Related

    Commit: [61adfb]

  • Neil Hodgson

    Neil Hodgson - 2017-05-27
    • status: open --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.