@scresto09 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);
Yes, I think I understood the problem you explained correctly.
But from what I understood, for cmd_goto_up this method is only really necessary when the line you want to go to is not the previous visible line.
With this fix my idea was to have "doc_line_from_visible_delta" fill the "previous" variable with the line number just below the visible line to access it with a SET_POS_NOX, then in any case do a SCI_LINEUP to go to the desired line.
Same for goto_down and SCI_LINEDOWN.