changeset 38722:b1f9c6a7a002

(Frecenter): If ARG < 0, and on a window system frame, count in some empty lines when we can't move -ARG lines down.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 07 Aug 2001 14:19:26 +0000
parents e8b8baf33da5
children 3a1c2213b3d2
files src/window.c
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/window.c	Tue Aug 07 13:36:14 2001 +0000
+++ b/src/window.c	Tue Aug 07 14:19:26 2001 +0000
@@ -4586,18 +4586,26 @@
 	{
 	  struct it it;
 	  struct text_pos pt;
-	  int y0, y1, h;
+	  int y0, y1, h, nlines;
 	  
 	  SET_TEXT_POS (pt, PT, PT_BYTE);
 	  start_display (&it, w, pt);
 	  y0 = it.current_y;
 
-	  /* The amount of pixels we have to move hack is the window
+	  /* The amount of pixels we have to move back is the window
 	     height minus what's displayed in the line containing PT,
 	     and the lines below.  */
-	  move_it_by_lines (&it, - XINT (arg) - 1, 1);
+	  nlines = - XINT (arg) - 1;
+	  move_it_by_lines (&it, nlines, 1);
+
 	  y1 = it.current_y - y0;
 	  h = line_bottom_y (&it) - y1;
+
+	  /* If we can't move down NLINES lines because we hit
+	     the end of the buffer, count in some empty lines.  */
+	  if (it.vpos < nlines)
+	    y1 += (nlines - it.vpos) * CANON_Y_UNIT (it.f);
+	  
 	  y0 = it.last_visible_y - y1 - h;
 	  
 	  start_display (&it, w, pt);