Mercurial > emacs
comparison src/xdisp.c @ 65046:f172c35729dd
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 20 Aug 2005 05:26:08 +0000 |
parents | a093a1e65b71 |
children | cbd9034375be |
comparison
equal
deleted
inserted
replaced
65045:bda8af17aa82 | 65046:f172c35729dd |
---|---|
7629 Lisp_Object window; | 7629 Lisp_Object window; |
7630 struct text_pos start; | 7630 struct text_pos start; |
7631 int window_height_changed_p = 0; | 7631 int window_height_changed_p = 0; |
7632 | 7632 |
7633 /* Do this before displaying, so that we have a large enough glyph | 7633 /* Do this before displaying, so that we have a large enough glyph |
7634 matrix for the display. */ | 7634 matrix for the display. If we can't get enough space for the |
7635 whole text, display the last N lines. That works by setting w->start. */ | |
7635 window_height_changed_p = resize_mini_window (w, 0); | 7636 window_height_changed_p = resize_mini_window (w, 0); |
7637 | |
7638 /* Use the starting position chosen by resize_mini_window. */ | |
7639 SET_TEXT_POS_FROM_MARKER (start, w->start); | |
7636 | 7640 |
7637 /* Display. */ | 7641 /* Display. */ |
7638 clear_glyph_matrix (w->desired_matrix); | 7642 clear_glyph_matrix (w->desired_matrix); |
7639 XSETWINDOW (window, w); | 7643 XSETWINDOW (window, w); |
7640 SET_TEXT_POS (start, BEG, BEG_BYTE); | |
7641 try_window (window, start, 0); | 7644 try_window (window, start, 0); |
7642 | 7645 |
7643 return window_height_changed_p; | 7646 return window_height_changed_p; |
7644 } | 7647 } |
7645 | 7648 |
7691 } | 7694 } |
7692 | 7695 |
7693 | 7696 |
7694 /* Resize mini-window W to fit the size of its contents. EXACT:P | 7697 /* Resize mini-window W to fit the size of its contents. EXACT:P |
7695 means size the window exactly to the size needed. Otherwise, it's | 7698 means size the window exactly to the size needed. Otherwise, it's |
7696 only enlarged until W's buffer is empty. Value is non-zero if | 7699 only enlarged until W's buffer is empty. |
7697 the window height has been changed. */ | 7700 |
7701 Set W->start to the right place to begin display. If the whole | |
7702 contents fit, start at the beginning. Otherwise, start so as | |
7703 to make the end of the contents appear. This is particularly | |
7704 important for y-or-n-p, but seems desirable generally. | |
7705 | |
7706 Value is non-zero if the window height has been changed. */ | |
7698 | 7707 |
7699 int | 7708 int |
7700 resize_mini_window (w, exact_p) | 7709 resize_mini_window (w, exact_p) |
7701 struct window *w; | 7710 struct window *w; |
7702 int exact_p; | 7711 int exact_p; |
7703 { | 7712 { |
7704 struct frame *f = XFRAME (w->frame); | 7713 struct frame *f = XFRAME (w->frame); |
7705 int window_height_changed_p = 0; | 7714 int window_height_changed_p = 0; |
7706 | 7715 |
7707 xassert (MINI_WINDOW_P (w)); | 7716 xassert (MINI_WINDOW_P (w)); |
7717 | |
7718 /* By default, start display at the beginning. */ | |
7719 set_marker_both (w->start, w->buffer, | |
7720 BUF_BEGV (XBUFFER (w->buffer)), | |
7721 BUF_BEGV_BYTE (XBUFFER (w->buffer))); | |
7708 | 7722 |
7709 /* Don't resize windows while redisplaying a window; it would | 7723 /* Don't resize windows while redisplaying a window; it would |
7710 confuse redisplay functions when the size of the window they are | 7724 confuse redisplay functions when the size of the window they are |
7711 displaying changes from under them. Such a resizing can happen, | 7725 displaying changes from under them. Such a resizing can happen, |
7712 for instance, when which-func prints a long message while | 7726 for instance, when which-func prints a long message while |
7767 | 7781 |
7768 /* Compute a suitable window start. */ | 7782 /* Compute a suitable window start. */ |
7769 if (height > max_height) | 7783 if (height > max_height) |
7770 { | 7784 { |
7771 height = max_height; | 7785 height = max_height; |
7772 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); | 7786 init_iterator (&it, w, ZV, ZV_BYTE, NULL, DEFAULT_FACE_ID); |
7773 move_it_vertically_backward (&it, (height - 1) * unit); | 7787 move_it_vertically_backward (&it, (height - 1) * unit); |
7774 start = it.current.pos; | 7788 start = it.current.pos; |
7789 SET_PT_BOTH (CHARPOS (start), BYTEPOS (start)); | |
7775 } | 7790 } |
7776 else | 7791 else |
7777 SET_TEXT_POS (start, BEGV, BEGV_BYTE); | 7792 SET_TEXT_POS (start, BEGV, BEGV_BYTE); |
7778 SET_MARKER_FROM_TEXT_POS (w->start, start); | 7793 SET_MARKER_FROM_TEXT_POS (w->start, start); |
7779 | 7794 |