GNU bug report logs -
#5718
scroll-margin in buffer with small line count.
Previous Next
Reported by: Oleksandr Gavenko <gavenkoa <at> gmail.com>
Date: Sun, 14 Mar 2010 17:28:02 UTC
Severity: wishlist
Tags: fixed, patch
Fixed in version 26.1
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
Full log
Message #43 received at 5718 <at> debbugs.gnu.org (full text, mbox):
martin rudalics <rudalics <at> gmx.at> writes:
> 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).
Oh, I just didn't think of those, I don't think there is a reason not to
use it. How about this (I use window_box_height instead of
Fwindow_text_height just to save the bother of struct window* to
Lisp_Object conversion):
@@ -4799,10 +4799,7 @@ window_scroll_margin (struct window *window, enum margin_unit unit)
if (scroll_margin > 0)
{
int frame_line_height = default_line_pixel_height (window);
- int window_total_lines
- = (window->total_lines * WINDOW_FRAME_LINE_HEIGHT (window)
- - WINDOW_MODE_LINE_HEIGHT (window))
- / frame_line_height;
+ int window_lines = window_box_height (window) / frame_line_height;
int margin, max_margin;
double ratio = 0.25;
@@ -4812,7 +4809,7 @@ window_scroll_margin (struct window *window, enum margin_unit unit)
ratio = max (0.0, ratio);
ratio = min (ratio, 0.5);
}
- max_margin = (int) (window_total_lines * ratio);
+ max_margin = (int) (window_lines * ratio);
margin = max (0, scroll_margin);
margin = min (scroll_margin, max_margin);
>
> +(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.
Oops, right.
This bug report was last modified 8 years and 168 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.