@techee commented on this pull request.
/* Calling SCI_LINEUP/SCI_LINEDOWN in a loop for num lines leads to visible
* slow scrolling. On the other hand, SCI_LINEUP preserves the value of * SCI_CHOOSECARETX which we cannot read directly from Scintilla and which * we want to keep - perform jump to previous/following line and add * one final SCI_LINEUP/SCI_LINEDOWN which recovers SCI_CHOOSECARETX for us. */ - one_above = p->line - p->num - 1; - if (one_above >= 0 && SSM(p->sci, SCI_GETLINEVISIBLE, one_above, 0)) - { - /* Every case except for the first line - go one line above and perform - * SCI_LINEDOWN. This ensures that even with wrapping on, we get the - * caret on the first line of the wrapped line */ - pos = SSM(p->sci, SCI_GETLINEENDPOSITION, one_above, 0); + + if (previous > -1) { + guint pos = SSM(p->sci, SCI_POSITIONFROMLINE, previous, 0);
OK, so it was me who misunderstood your code :-).
Even though your version works, I'll probably go for https://github.com/geany/geany-plugins/pull/1338 which is easier for me to understand - unless you have some problems with it.