(displayed_window_lines): Take empty lines at
authorGerd Moellmann <gerd@gnu.org>
Wed, 7 Jun 2000 12:42:30 +0000 (12:42 +0000)
committerGerd Moellmann <gerd@gnu.org>
Wed, 7 Jun 2000 12:42:30 +0000 (12:42 +0000)
the bottom of a window into account.

src/ChangeLog
src/window.c

index 2a5875d..4c36ba9 100644 (file)
@@ -1,5 +1,8 @@
 2000-06-07  Gerd Moellmann  <gerd@gnu.org>
 
+       * window.c (displayed_window_lines): Take empty lines at
+       the bottom of a window into account.
+       
        * window.c (displayed_window_lines): New function.
        (Fmove_to_window_line): Use displayed_window_lines to determine
        the number of lines to move, instead of using the window's height.
index a5ce488..1289d18 100644 (file)
@@ -4227,10 +4227,21 @@ displayed_window_lines (w)
 {
   struct it it;
   struct text_pos start;
+  int height = window_box_height (w);
 
   SET_TEXT_POS_FROM_MARKER (start, w->start);
   start_display (&it, w, start);
-  move_it_vertically (&it, window_box_height (w));
+  move_it_vertically (&it, height);
+
+  /* Add in empty lines at the bottom of the window.  */
+  if (it.current_y < height)
+    {
+      struct frame *f = XFRAME (w->frame);
+      int rest = height - it.current_y;
+      int lines = (rest + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f);
+      it.vpos += lines;
+    }
+  
   return it.vpos;
 }