summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2000-10-30 12:51:17 +0000
committerGerd Moellmann <gerd@gnu.org>2000-10-30 12:51:17 +0000
commitad4a9a79d2e54ec59905eb42f5bd4fa190202dae (patch)
tree3338fe3861b42cc22c611515e1d9be377c369e83
parenta1d34b1eee5f19bf1e39ca9824b9bfe60e0dfb4a (diff)
downloademacs-ad4a9a79d2e54ec59905eb42f5bd4fa190202dae.tar.gz
(displayed_window_lines): Change buffers if necessary.
Fix computation of displayed lines.
-rw-r--r--src/window.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/window.c b/src/window.c
index b408c40f8fd..12b15424c28 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4324,19 +4324,35 @@ displayed_window_lines (w)
struct it it;
struct text_pos start;
int height = window_box_height (w);
+ struct buffer *old_buffer;
+ int bottom_y;
+
+ if (XBUFFER (w->buffer) != current_buffer)
+ {
+ old_buffer = current_buffer;
+ set_buffer_internal (XBUFFER (w->buffer));
+ }
+ else
+ old_buffer = NULL;
SET_TEXT_POS_FROM_MARKER (start, w->start);
start_display (&it, w, start);
move_it_vertically (&it, height);
+ if (old_buffer)
+ set_buffer_internal (old_buffer);
+
/* Add in empty lines at the bottom of the window. */
- if (it.current_y < height)
+ bottom_y = it.current_y + it.max_ascent + it.max_descent;
+ if (bottom_y < height)
{
struct frame *f = XFRAME (w->frame);
- int rest = height - it.current_y;
+ int rest = height - bottom_y;
int lines = (rest + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f);
it.vpos += lines;
}
+ else if (bottom_y > height)
+ ++it.vpos;
return it.vpos;
}