From 40b388f98ce27057cff72ff65fc3ee91a2e7344d Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 20 Aug 2005 05:26:27 +0000 Subject: [PATCH] (display_echo_area_1): Get display start pos from w->start. (resize_mini_window): Set w->start, and PT, so as to display the tail end of the buffer, if it doesn't all fit. --- src/ChangeLog | 6 ++++++ src/xdisp.c | 25 ++++++++++++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index d568243a0e7..7bc84cfbdbf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2005-08-20 Richard M. Stallman + + * xdisp.c (display_echo_area_1): Get display start pos from w->start. + (resize_mini_window): Set w->start, and PT, so as to display the tail + end of the buffer, if it doesn't all fit. + 2005-08-18 Kim F. Storm * xdisp.c (calc_pixel_width_or_height): Use actual display diff --git a/src/xdisp.c b/src/xdisp.c index 6ed5fd151d6..3a4f3f001ab 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -7631,13 +7631,16 @@ display_echo_area_1 (a1, a2, a3, a4) int window_height_changed_p = 0; /* Do this before displaying, so that we have a large enough glyph - matrix for the display. */ + matrix for the display. If we can't get enough space for the + whole text, display the last N lines. That works by setting w->start. */ window_height_changed_p = resize_mini_window (w, 0); + /* Use the starting position chosen by resize_mini_window. */ + SET_TEXT_POS_FROM_MARKER (start, w->start); + /* Display. */ clear_glyph_matrix (w->desired_matrix); XSETWINDOW (window, w); - SET_TEXT_POS (start, BEG, BEG_BYTE); try_window (window, start, 0); return window_height_changed_p; @@ -7693,8 +7696,14 @@ resize_mini_window_1 (a1, exactly, a3, a4) /* Resize mini-window W to fit the size of its contents. EXACT:P means size the window exactly to the size needed. Otherwise, it's - only enlarged until W's buffer is empty. Value is non-zero if - the window height has been changed. */ + only enlarged until W's buffer is empty. + + Set W->start to the right place to begin display. If the whole + contents fit, start at the beginning. Otherwise, start so as + to make the end of the contents appear. This is particularly + important for y-or-n-p, but seems desirable generally. + + Value is non-zero if the window height has been changed. */ int resize_mini_window (w, exact_p) @@ -7706,6 +7715,11 @@ resize_mini_window (w, exact_p) xassert (MINI_WINDOW_P (w)); + /* By default, start display at the beginning. */ + set_marker_both (w->start, w->buffer, + BUF_BEGV (XBUFFER (w->buffer)), + BUF_BEGV_BYTE (XBUFFER (w->buffer))); + /* Don't resize windows while redisplaying a window; it would confuse redisplay functions when the size of the window they are displaying changes from under them. Such a resizing can happen, @@ -7769,9 +7783,10 @@ resize_mini_window (w, exact_p) if (height > max_height) { height = max_height; - init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); + init_iterator (&it, w, ZV, ZV_BYTE, NULL, DEFAULT_FACE_ID); move_it_vertically_backward (&it, (height - 1) * unit); start = it.current.pos; + SET_PT_BOTH (CHARPOS (start), BYTEPOS (start)); } else SET_TEXT_POS (start, BEGV, BEGV_BYTE); -- 2.39.2