aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2000-10-30 12:51:17 +0000
committerGerd Moellmann2000-10-30 12:51:17 +0000
commitad4a9a79d2e54ec59905eb42f5bd4fa190202dae (patch)
tree3338fe3861b42cc22c611515e1d9be377c369e83 /src
parenta1d34b1eee5f19bf1e39ca9824b9bfe60e0dfb4a (diff)
downloademacs-ad4a9a79d2e54ec59905eb42f5bd4fa190202dae.tar.gz
emacs-ad4a9a79d2e54ec59905eb42f5bd4fa190202dae.zip
(displayed_window_lines): Change buffers if necessary.
Fix computation of displayed lines.
Diffstat (limited to 'src')
-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)
4324 struct it it; 4324 struct it it;
4325 struct text_pos start; 4325 struct text_pos start;
4326 int height = window_box_height (w); 4326 int height = window_box_height (w);
4327 struct buffer *old_buffer;
4328 int bottom_y;
4329
4330 if (XBUFFER (w->buffer) != current_buffer)
4331 {
4332 old_buffer = current_buffer;
4333 set_buffer_internal (XBUFFER (w->buffer));
4334 }
4335 else
4336 old_buffer = NULL;
4327 4337
4328 SET_TEXT_POS_FROM_MARKER (start, w->start); 4338 SET_TEXT_POS_FROM_MARKER (start, w->start);
4329 start_display (&it, w, start); 4339 start_display (&it, w, start);
4330 move_it_vertically (&it, height); 4340 move_it_vertically (&it, height);
4331 4341
4342 if (old_buffer)
4343 set_buffer_internal (old_buffer);
4344
4332 /* Add in empty lines at the bottom of the window. */ 4345 /* Add in empty lines at the bottom of the window. */
4333 if (it.current_y < height) 4346 bottom_y = it.current_y + it.max_ascent + it.max_descent;
4347 if (bottom_y < height)
4334 { 4348 {
4335 struct frame *f = XFRAME (w->frame); 4349 struct frame *f = XFRAME (w->frame);
4336 int rest = height - it.current_y; 4350 int rest = height - bottom_y;
4337 int lines = (rest + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f); 4351 int lines = (rest + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f);
4338 it.vpos += lines; 4352 it.vpos += lines;
4339 } 4353 }
4354 else if (bottom_y > height)
4355 ++it.vpos;
4340 4356
4341 return it.vpos; 4357 return it.vpos;
4342} 4358}