diff --git a/modules/ui/smooth-scroll/config.el b/modules/ui/smooth-scroll/config.el index 924df1b3f..2729d9195 100644 --- a/modules/ui/smooth-scroll/config.el +++ b/modules/ui/smooth-scroll/config.el @@ -27,6 +27,20 @@ (setq mwheel-scroll-up-function #'scroll-up mwheel-scroll-down-function #'scroll-down)))) + ;; HACK: good-scroll advises interactive motion commands to trigger + ;; interpolated scrolling. It expects these commands to only be called + ;; interactively, but there are cases (like in `ledger-mode') where they (in + ;; this case, `move-end-of-line') are called programmatically where the + ;; selected window's boundaries may be out of bounds for the target buffer. + ;; Cue the errors. + ;; REVIEW: This shold be fixed upstream. + (defadvice! +smooth-scroll--fix-out-of-bounds-error-a () + :override #'good-scroll--point-at-top-fix-a + (save-restriction + (widen) + (<= (line-number-at-pos (max (point) (point-min)) t) + (1+ (line-number-at-pos (min (window-start) (point-max)) t))))) + (defun good-scroll--convert-line-to-step (line) (cond ((integerp line) (* line (line-pixel-height))) ((or (null line) (memq '- line))