Eli Zaretskii writes: >> From: npostavs@users.sourceforge.net >> Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com >> Date: Sat, 13 Aug 2016 18:01:43 -0400 >> >> >> this_scroll_margin = max (0, scroll_margin); >> >> this_scroll_margin >> >> = min (this_scroll_margin, window_total_lines / 4); >> > >> > Which reveals a subtle bug: the actual scroll margin should be 1 for 7 >> > lines, 2 for 11, etc. The problem is that the value of >> > window_total_lines includes the mode line, which it shouldn't. Maybe >> > this should be fixed. I have a patch set for fixing this and allowing the user to change the maximum margin from 0.25. The latter doesn't quite work perfectly, for some reason when setting the maximum margin to 0.5 and scroll-margin to 100, `scroll-down-command' doesn't keep point centered in the window, even though other commands (e.g. `scroll-up-command') do. The patches come with tests demonstrating this (the tests only work in interactive mode).