bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19060: [FIX INCLUDED] Off-by-one-line scrolling bug in window_scroll


From: martin rudalics
Subject: bug#19060: [FIX INCLUDED] Off-by-one-line scrolling bug in window_scroll_pixel_based
Date: Sat, 15 Nov 2014 12:13:17 +0100

First of all many thanks to Kelly Dean for finding the problem and
proposing a solution.

> Martin, I propose the following patch:
>
> diff --git a/src/window.c b/src/window.c
> index b002423..7462fdc 100644
> --- a/src/window.c
> +++ b/src/window.c
> @@ -4956,8 +4956,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, 
bool whole, int noerror)
>      int px;
>      int dy = frame_line_height;
>      if (whole)
> -      dy = max ((window_box_height (w)
> -                 - next_screen_context_lines * dy),
> +      dy = max ((window_box_height (w) / dy
> +                 - next_screen_context_lines) * dy,
>                  dy);
>      dy *= n;
>
> @@ -5039,8 +5039,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, 
bool whole, int noerror)
>       {
>         ptrdiff_t start_pos = IT_CHARPOS (it);
>         int dy = frame_line_height;
> -      dy = max ((window_box_height (w)
> -           - next_screen_context_lines * dy),
> +      dy = max ((window_box_height (w) / dy - next_screen_context_lines) * 
dy,
>            dy) * n;
>
>         /* Note that move_it_vertically always moves the iterator to the

If it works for you, please apply it.  I'm too silly to understand it,
though.  IIUC we have a rounding issue which makes us go by one line too
far or too few when scrolling up and your patch compensates that
rounding issue by putting it back into that window_box_height (w) / dy
calculation.  Could you add comments which tell more or less how you
corrected the issue?

Thanks, martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]