branch: elpa/scroll-on-jump commit 89230f620b4f57ed0799fc3f576dc569566d375b Author: Campbell Barton <ideasma...@gmail.com> Commit: Campbell Barton <ideasma...@gmail.com>
Fix #28: Scroll takes longer than the duration for longer distances Use `round` instead of `floor` to more accurate meet the duration. --- scroll-on-jump.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scroll-on-jump.el b/scroll-on-jump.el index 7ab611be59..a6164dac45 100644 --- a/scroll-on-jump.el +++ b/scroll-on-jump.el @@ -283,7 +283,7 @@ Moving the point when ALSO-MOVE-POINT is set." (step (let* ((time-elapsed (float-time (time-subtract (current-time) time-init))) (factor (min 1.0 (/ time-elapsed time-limit))) - (lines-target (floor (funcall interp-fn 0.0 lines-scroll-abs factor))) + (lines-target (round (funcall interp-fn 0.0 lines-scroll-abs factor))) (lines-remainder (- lines-target lines-done-abs))) ;; Step result, we must move at least one line. (* dir (max 1 lines-remainder))))) @@ -371,7 +371,7 @@ Argument ALSO-MOVE-POINT moves the point while scrolling." (step (let* ((time-elapsed (float-time (time-subtract (current-time) time-init))) (factor (min 1.0 (/ time-elapsed time-limit))) - (px-target (floor (funcall interp-fn 0.0 px-scroll-abs factor))) + (px-target (round (funcall interp-fn 0.0 px-scroll-abs factor))) (px-remainder (- px-target px-done-abs))) (* dir px-remainder))))