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: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: kelly <at> prtime.org, 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 13:17:47 +0200
> Date: Sat, 15 Nov 2014 12:13:17 +0100
> From: martin rudalics <rudalics <at> gmx.at>
> CC: 19060 <at> debbugs.gnu.org
> 
>  > 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.

It evidently works for Kelly.

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

Yes.  Why is it hard to understand?

> Could you add comments which tell more or less how you corrected the
> issue?

Will do, once we agree that this is the right fix.




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

Previous Next


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