diff options
| author | Gerd Moellmann | 2000-09-02 21:56:47 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-09-02 21:56:47 +0000 |
| commit | 715e84c950d3dadaa9049af529833f507999d2fe (patch) | |
| tree | 09f9fcc60ab9b22379a9fe2d52c251b72433aa47 /src | |
| parent | 8892f40bde07b11c5e2c24719acbcf7239f42de3 (diff) | |
| download | emacs-715e84c950d3dadaa9049af529833f507999d2fe.tar.gz emacs-715e84c950d3dadaa9049af529833f507999d2fe.zip | |
(redisplay_mode_lines): New function.
(display_mode_lines): Return number of mode lines displayed.
(echo_area_display): Use redisplay_mode_lines to draw garbaged
mode lines. Don't temporarily bind redisplay-dont-pause to t.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 158 |
2 files changed, 130 insertions, 33 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 09108b858f6..9f7bc8fc412 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2000-09-02 Gerd Moellmann <gerd@gnu.org> | 1 | 2000-09-02 Gerd Moellmann <gerd@gnu.org> |
| 2 | 2 | ||
| 3 | * xdisp.c (redisplay_mode_lines): New function. | ||
| 4 | (display_mode_lines): Return number of mode lines displayed. | ||
| 5 | (echo_area_display): Use redisplay_mode_lines to draw garbaged | ||
| 6 | mode lines. Don't temporarily bind redisplay-dont-pause to t. | ||
| 7 | |||
| 3 | * emacs.c, callint.c, doc.c, editfns.c: Remove includes of | 8 | * emacs.c, callint.c, doc.c, editfns.c: Remove includes of |
| 4 | string.h and strings.h. | 9 | string.h and strings.h. |
| 5 | (index) [HAVE_INDEX]: Add prototype. | 10 | (index) [HAVE_INDEX]: Add prototype. |
diff --git a/src/xdisp.c b/src/xdisp.c index e8805a314f2..351d710ea40 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -624,6 +624,7 @@ enum move_it_result | |||
| 624 | 624 | ||
| 625 | /* Function prototypes. */ | 625 | /* Function prototypes. */ |
| 626 | 626 | ||
| 627 | static int redisplay_mode_lines P_ ((Lisp_Object, int)); | ||
| 627 | static char *decode_mode_spec_coding P_ ((Lisp_Object, char *, int)); | 628 | static char *decode_mode_spec_coding P_ ((Lisp_Object, char *, int)); |
| 628 | static int invisible_text_between_p P_ ((struct it *, int, int)); | 629 | static int invisible_text_between_p P_ ((struct it *, int, int)); |
| 629 | static int next_element_from_ellipsis P_ ((struct it *)); | 630 | static int next_element_from_ellipsis P_ ((struct it *)); |
| @@ -682,7 +683,7 @@ static void update_menu_bar P_ ((struct frame *, int)); | |||
| 682 | static int try_window_reusing_current_matrix P_ ((struct window *)); | 683 | static int try_window_reusing_current_matrix P_ ((struct window *)); |
| 683 | static int try_window_id P_ ((struct window *)); | 684 | static int try_window_id P_ ((struct window *)); |
| 684 | static int display_line P_ ((struct it *)); | 685 | static int display_line P_ ((struct it *)); |
| 685 | static void display_mode_lines P_ ((struct window *)); | 686 | static int display_mode_lines P_ ((struct window *)); |
| 686 | static void display_mode_line P_ ((struct window *, enum face_id, | 687 | static void display_mode_line P_ ((struct window *, enum face_id, |
| 687 | Lisp_Object)); | 688 | Lisp_Object)); |
| 688 | static int display_mode_element P_ ((struct it *, int, int, int, Lisp_Object)); | 689 | static int display_mode_element P_ ((struct it *, int, int, int, Lisp_Object)); |
| @@ -6290,26 +6291,30 @@ echo_area_display (update_frame_p) | |||
| 6290 | window_height_changed_p = display_echo_area (w); | 6291 | window_height_changed_p = display_echo_area (w); |
| 6291 | w->must_be_updated_p = 1; | 6292 | w->must_be_updated_p = 1; |
| 6292 | 6293 | ||
| 6294 | /* Update the display, unless called from redisplay_internal. */ | ||
| 6293 | if (update_frame_p) | 6295 | if (update_frame_p) |
| 6294 | { | 6296 | { |
| 6295 | /* Not called from redisplay_internal. */ | 6297 | int n = 0; |
| 6296 | 6298 | ||
| 6297 | if (!display_completed || window_height_changed_p) | 6299 | /* If the display update has been interrupted by pending |
| 6300 | input, update mode lines in the frame. Due to the | ||
| 6301 | pending input, it might have been that redisplay hasn't | ||
| 6302 | been called, so that mode lines above the echo area are | ||
| 6303 | garbaged. This looks odd, so we prevent it here. */ | ||
| 6304 | if (!display_completed) | ||
| 6305 | n = redisplay_mode_lines (FRAME_ROOT_WINDOW (f), 0); | ||
| 6306 | |||
| 6307 | if (window_height_changed_p) | ||
| 6298 | { | 6308 | { |
| 6299 | /* Must update other windows. If current display is not | 6309 | /* Must update other windows. */ |
| 6300 | up-to-date because the last redisplay was interrupted | ||
| 6301 | by pending input, esp. the mode-line above the echo | ||
| 6302 | area might display garbage which looks odd. */ | ||
| 6303 | int count = specpdl_ptr - specpdl; | ||
| 6304 | specbind (Qredisplay_dont_pause, Qt); | ||
| 6305 | windows_or_buffers_changed = 1; | 6310 | windows_or_buffers_changed = 1; |
| 6306 | redisplay_internal (0); | 6311 | redisplay_internal (0); |
| 6307 | unbind_to (count, Qnil); | ||
| 6308 | } | 6312 | } |
| 6309 | else if (FRAME_WINDOW_P (f)) | 6313 | else if (FRAME_WINDOW_P (f) && n == 0) |
| 6310 | { | 6314 | { |
| 6311 | /* Window configuration is the same as before. | 6315 | /* Window configuration is the same as before. |
| 6312 | Can do with a display update of the echo area. */ | 6316 | Can do with a display update of the echo area, |
| 6317 | unless we displayed some mode lines. */ | ||
| 6313 | update_single_window (w, 1); | 6318 | update_single_window (w, 1); |
| 6314 | rif->flush_display (f); | 6319 | rif->flush_display (f); |
| 6315 | } | 6320 | } |
| @@ -12026,23 +12031,106 @@ display_menu_bar (w) | |||
| 12026 | Mode Line | 12031 | Mode Line |
| 12027 | ***********************************************************************/ | 12032 | ***********************************************************************/ |
| 12028 | 12033 | ||
| 12029 | /* Display the mode and/or top line of window W. */ | 12034 | /* Redisplay mode lines in the window tree whose root is WINDOW. If |
| 12035 | FORCE is non-zero, redisplay mode lines unconditionally. | ||
| 12036 | Otherwise, redisplay only mode lines that are garbaged. Value is | ||
| 12037 | the number of windows whose mode lines were redisplayed. */ | ||
| 12030 | 12038 | ||
| 12031 | static void | 12039 | static int |
| 12040 | redisplay_mode_lines (window, force) | ||
| 12041 | Lisp_Object window; | ||
| 12042 | int force; | ||
| 12043 | { | ||
| 12044 | int nwindows = 0; | ||
| 12045 | |||
| 12046 | while (!NILP (window)) | ||
| 12047 | { | ||
| 12048 | struct window *w = XWINDOW (window); | ||
| 12049 | |||
| 12050 | if (WINDOWP (w->hchild)) | ||
| 12051 | nwindows += redisplay_mode_lines (w->hchild, force); | ||
| 12052 | else if (WINDOWP (w->vchild)) | ||
| 12053 | nwindows += redisplay_mode_lines (w->vchild, force); | ||
| 12054 | else if (force | ||
| 12055 | || FRAME_GARBAGED_P (XFRAME (w->frame)) | ||
| 12056 | || !MATRIX_MODE_LINE_ROW (w->current_matrix)->enabled_p) | ||
| 12057 | { | ||
| 12058 | Lisp_Object old_selected_frame; | ||
| 12059 | struct text_pos lpoint; | ||
| 12060 | struct buffer *old = current_buffer; | ||
| 12061 | |||
| 12062 | /* Set the window's buffer for the mode line display. */ | ||
| 12063 | SET_TEXT_POS (lpoint, PT, PT_BYTE); | ||
| 12064 | set_buffer_internal_1 (XBUFFER (w->buffer)); | ||
| 12065 | |||
| 12066 | /* Point refers normally to the selected window. For any | ||
| 12067 | other window, set up appropriate value. */ | ||
| 12068 | if (!EQ (window, selected_window)) | ||
| 12069 | { | ||
| 12070 | struct text_pos pt; | ||
| 12071 | |||
| 12072 | SET_TEXT_POS_FROM_MARKER (pt, w->pointm); | ||
| 12073 | if (CHARPOS (pt) < BEGV) | ||
| 12074 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); | ||
| 12075 | else if (CHARPOS (pt) > (ZV - 1)) | ||
| 12076 | TEMP_SET_PT_BOTH (ZV, ZV_BYTE); | ||
| 12077 | else | ||
| 12078 | TEMP_SET_PT_BOTH (CHARPOS (pt), BYTEPOS (pt)); | ||
| 12079 | } | ||
| 12080 | |||
| 12081 | /* Temporarily set up the selected frame. */ | ||
| 12082 | old_selected_frame = selected_frame; | ||
| 12083 | selected_frame = w->frame; | ||
| 12084 | |||
| 12085 | /* Display mode lines. */ | ||
| 12086 | clear_glyph_matrix (w->desired_matrix); | ||
| 12087 | if (display_mode_lines (w)) | ||
| 12088 | { | ||
| 12089 | ++nwindows; | ||
| 12090 | w->must_be_updated_p = 1; | ||
| 12091 | } | ||
| 12092 | |||
| 12093 | /* Restore old settings. */ | ||
| 12094 | selected_frame = old_selected_frame; | ||
| 12095 | set_buffer_internal_1 (old); | ||
| 12096 | TEMP_SET_PT_BOTH (CHARPOS (lpoint), BYTEPOS (lpoint)); | ||
| 12097 | } | ||
| 12098 | |||
| 12099 | window = w->next; | ||
| 12100 | } | ||
| 12101 | |||
| 12102 | return nwindows; | ||
| 12103 | } | ||
| 12104 | |||
| 12105 | |||
| 12106 | /* Display the mode and/or top line of window W. Value is the number | ||
| 12107 | of mode lines displayed. */ | ||
| 12108 | |||
| 12109 | static int | ||
| 12032 | display_mode_lines (w) | 12110 | display_mode_lines (w) |
| 12033 | struct window *w; | 12111 | struct window *w; |
| 12034 | { | 12112 | { |
| 12113 | int n = 0; | ||
| 12114 | |||
| 12035 | /* These will be set while the mode line specs are processed. */ | 12115 | /* These will be set while the mode line specs are processed. */ |
| 12036 | line_number_displayed = 0; | 12116 | line_number_displayed = 0; |
| 12037 | w->column_number_displayed = Qnil; | 12117 | w->column_number_displayed = Qnil; |
| 12038 | 12118 | ||
| 12039 | if (WINDOW_WANTS_MODELINE_P (w)) | 12119 | if (WINDOW_WANTS_MODELINE_P (w)) |
| 12040 | display_mode_line (w, MODE_LINE_FACE_ID, | 12120 | { |
| 12041 | current_buffer->mode_line_format); | 12121 | display_mode_line (w, MODE_LINE_FACE_ID, |
| 12122 | current_buffer->mode_line_format); | ||
| 12123 | ++n; | ||
| 12124 | } | ||
| 12042 | 12125 | ||
| 12043 | if (WINDOW_WANTS_HEADER_LINE_P (w)) | 12126 | if (WINDOW_WANTS_HEADER_LINE_P (w)) |
| 12044 | display_mode_line (w, HEADER_LINE_FACE_ID, | 12127 | { |
| 12045 | current_buffer->header_line_format); | 12128 | display_mode_line (w, HEADER_LINE_FACE_ID, |
| 12129 | current_buffer->header_line_format); | ||
| 12130 | ++n; | ||
| 12131 | } | ||
| 12132 | |||
| 12133 | return n; | ||
| 12046 | } | 12134 | } |
| 12047 | 12135 | ||
| 12048 | 12136 | ||
| @@ -13157,6 +13245,7 @@ invisible_p (propval, list) | |||
| 13157 | Lisp_Object list; | 13245 | Lisp_Object list; |
| 13158 | { | 13246 | { |
| 13159 | register Lisp_Object tail, proptail; | 13247 | register Lisp_Object tail, proptail; |
| 13248 | |||
| 13160 | for (tail = list; CONSP (tail); tail = XCDR (tail)) | 13249 | for (tail = list; CONSP (tail); tail = XCDR (tail)) |
| 13161 | { | 13250 | { |
| 13162 | register Lisp_Object tem; | 13251 | register Lisp_Object tem; |
| @@ -13166,22 +13255,25 @@ invisible_p (propval, list) | |||
| 13166 | if (CONSP (tem) && EQ (propval, XCAR (tem))) | 13255 | if (CONSP (tem) && EQ (propval, XCAR (tem))) |
| 13167 | return 1; | 13256 | return 1; |
| 13168 | } | 13257 | } |
| 13258 | |||
| 13169 | if (CONSP (propval)) | 13259 | if (CONSP (propval)) |
| 13170 | for (proptail = propval; CONSP (proptail); | 13260 | { |
| 13171 | proptail = XCDR (proptail)) | 13261 | for (proptail = propval; CONSP (proptail); proptail = XCDR (proptail)) |
| 13172 | { | 13262 | { |
| 13173 | Lisp_Object propelt; | 13263 | Lisp_Object propelt; |
| 13174 | propelt = XCAR (proptail); | 13264 | propelt = XCAR (proptail); |
| 13175 | for (tail = list; CONSP (tail); tail = XCDR (tail)) | 13265 | for (tail = list; CONSP (tail); tail = XCDR (tail)) |
| 13176 | { | 13266 | { |
| 13177 | register Lisp_Object tem; | 13267 | register Lisp_Object tem; |
| 13178 | tem = XCAR (tail); | 13268 | tem = XCAR (tail); |
| 13179 | if (EQ (propelt, tem)) | 13269 | if (EQ (propelt, tem)) |
| 13180 | return 1; | 13270 | return 1; |
| 13181 | if (CONSP (tem) && EQ (propelt, XCAR (tem))) | 13271 | if (CONSP (tem) && EQ (propelt, XCAR (tem))) |
| 13182 | return 1; | 13272 | return 1; |
| 13183 | } | 13273 | } |
| 13184 | } | 13274 | } |
| 13275 | } | ||
| 13276 | |||
| 13185 | return 0; | 13277 | return 0; |
| 13186 | } | 13278 | } |
| 13187 | 13279 | ||