GNU bug report logs - #19060
[FIX INCLUDED] Off-by-one-line scrolling bug in window_scroll_pixel_based

Previous Next

Package: emacs;

Reported by: Kelly Dean <kelly <at> prtime.org>

Date: Sat, 15 Nov 2014 08:05:04 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>, Kelly Dean <kelly <at> prtime.org>
Cc: 19060 <at> debbugs.gnu.org
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




This bug report was last modified 10 years and 246 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.