From 3091c2a6523ee0ba7c017b081997e22480ef9419 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Wed, 7 Jun 2000 12:42:30 +0000 Subject: [PATCH] (displayed_window_lines): Take empty lines at the bottom of a window into account. --- src/ChangeLog | 3 +++ src/window.c | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2a5875dac96..4c36ba9cd81 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2000-06-07 Gerd Moellmann + * 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. diff --git a/src/window.c b/src/window.c index a5ce48813b8..1289d18679b 100644 --- a/src/window.c +++ b/src/window.c @@ -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; } -- 2.39.2