Subject: Re: bug#5718: scroll-margin in buffer with small line count.

From: martin rudalics <[email-masked]>
Date: Mon, 12 Sep 2016 08:19:59 +0200

> 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).

Thank you.

        int window_total_lines
-        = window->total_lines * WINDOW_FRAME_LINE_HEIGHT (window)
+        = (window->total_lines * WINDOW_FRAME_LINE_HEIGHT (window)
+           - WINDOW_MODE_LINE_HEIGHT (window))

Please use another name instead of "window_total_lines" here.  And
please explain why you can't use Fwindow_text_height here (i.e., why
header lines, horizontal scrollbars and window dividers apparently don't
count).

+(defmacro window-with-test-buffer-window (&rest body)

Please call it ‘window-test-with-test-buffer-window’ to consistentlyy
keep the ‘window-test-’ prefix on everything defined in this file.

martin