diff options
| author | Gerd Moellmann | 1999-09-12 20:21:58 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-09-12 20:21:58 +0000 |
| commit | 92a90e893abce4d7112aec8b00aff4234a5614bf (patch) | |
| tree | b6a77b2a285112e53b51a66f13eb2e3dd62fc861 /src | |
| parent | abf4a9f7e0a6ac633660d95004ac2a0407a82c02 (diff) | |
| download | emacs-92a90e893abce4d7112aec8b00aff4234a5614bf.tar.gz emacs-92a90e893abce4d7112aec8b00aff4234a5614bf.zip | |
(resize_mini_window): Add parameter exact_p. Resize
to exact size if exact_p is non-zero.
(display_echo_area_1): Call resize_mini_window with
new parameter.
(redisplay_internal): Ditto.
(resize_echo_area_axactly): New.
(hscroll_window_tree): Choose cursor row from
desired or current matrix.
(redisplay_internal): Hscroll before updating.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 83 |
1 files changed, 67 insertions, 16 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 46c22299ecb..ab3547dc338 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -5187,7 +5187,6 @@ with_echo_area_buffer (w, which, fn, a1, a2, a3, a4, a5) | |||
| 5187 | if (!NILP (echo_area_buffer[this_one]) | 5187 | if (!NILP (echo_area_buffer[this_one]) |
| 5188 | && EQ (echo_area_buffer[this_one], echo_area_buffer[the_other])) | 5188 | && EQ (echo_area_buffer[this_one], echo_area_buffer[the_other])) |
| 5189 | echo_area_buffer[this_one] = Qnil; | 5189 | echo_area_buffer[this_one] = Qnil; |
| 5190 | |||
| 5191 | } | 5190 | } |
| 5192 | 5191 | ||
| 5193 | /* Choose a suitable buffer from echo_buffer[] is we don't | 5192 | /* Choose a suitable buffer from echo_buffer[] is we don't |
| @@ -5403,7 +5402,7 @@ display_echo_area_1 (w) | |||
| 5403 | 5402 | ||
| 5404 | /* Do this before displaying, so that we have a large enough glyph | 5403 | /* Do this before displaying, so that we have a large enough glyph |
| 5405 | matrix for the display. */ | 5404 | matrix for the display. */ |
| 5406 | window_height_changed_p = resize_mini_window (w); | 5405 | window_height_changed_p = resize_mini_window (w, 0); |
| 5407 | 5406 | ||
| 5408 | /* Display. */ | 5407 | /* Display. */ |
| 5409 | clear_glyph_matrix (w->desired_matrix); | 5408 | clear_glyph_matrix (w->desired_matrix); |
| @@ -5415,12 +5414,40 @@ display_echo_area_1 (w) | |||
| 5415 | } | 5414 | } |
| 5416 | 5415 | ||
| 5417 | 5416 | ||
| 5418 | /* Resize mini-window W to fit the size of its contents. Value is | 5417 | /* Resize the echo area window to exactly the size needed for the |
| 5419 | non-zero if the window height has been changed. */ | 5418 | currently displayed message, if there is one. */ |
| 5419 | |||
| 5420 | void | ||
| 5421 | resize_echo_area_axactly () | ||
| 5422 | { | ||
| 5423 | if (BUFFERP (echo_area_buffer[0]) | ||
| 5424 | && WINDOWP (echo_area_window)) | ||
| 5425 | { | ||
| 5426 | struct window *w = XWINDOW (echo_area_window); | ||
| 5427 | int resized_p; | ||
| 5428 | |||
| 5429 | resized_p = with_echo_area_buffer (w, 0, | ||
| 5430 | (int (*) ()) resize_mini_window, | ||
| 5431 | w, 1); | ||
| 5432 | if (resized_p) | ||
| 5433 | { | ||
| 5434 | ++windows_or_buffers_changed; | ||
| 5435 | ++update_mode_lines; | ||
| 5436 | redisplay_internal (0); | ||
| 5437 | } | ||
| 5438 | } | ||
| 5439 | } | ||
| 5440 | |||
| 5441 | |||
| 5442 | /* Resize mini-window W to fit the size of its contents. EXACT:P | ||
| 5443 | means size the window exactly to the size needed. Otherwise, it's | ||
| 5444 | only enlarged until W's buffer is empty. Value is non-zero if | ||
| 5445 | the window height has been changed. */ | ||
| 5420 | 5446 | ||
| 5421 | int | 5447 | int |
| 5422 | resize_mini_window (w) | 5448 | resize_mini_window (w, exact_p) |
| 5423 | struct window *w; | 5449 | struct window *w; |
| 5450 | int exact_p; | ||
| 5424 | { | 5451 | { |
| 5425 | struct frame *f = XFRAME (w->frame); | 5452 | struct frame *f = XFRAME (w->frame); |
| 5426 | int window_height_changed_p = 0; | 5453 | int window_height_changed_p = 0; |
| @@ -5474,6 +5501,7 @@ resize_mini_window (w) | |||
| 5474 | /* Let it grow only, until we display an empty message, in which | 5501 | /* Let it grow only, until we display an empty message, in which |
| 5475 | case the window shrinks again. */ | 5502 | case the window shrinks again. */ |
| 5476 | if (height > XFASTINT (w->height) | 5503 | if (height > XFASTINT (w->height) |
| 5504 | || exact_p | ||
| 5477 | || BEGV == ZV) | 5505 | || BEGV == ZV) |
| 5478 | { | 5506 | { |
| 5479 | Lisp_Object old_selected_window; | 5507 | Lisp_Object old_selected_window; |
| @@ -6645,8 +6673,14 @@ hscroll_window_tree (window) | |||
| 6645 | { | 6673 | { |
| 6646 | int hscroll_margin, text_area_x, text_area_y; | 6674 | int hscroll_margin, text_area_x, text_area_y; |
| 6647 | int text_area_width, text_area_height; | 6675 | int text_area_width, text_area_height; |
| 6648 | struct glyph_row *cursor_row = MATRIX_ROW (w->current_matrix, | 6676 | struct glyph_row *current_cursor_row |
| 6649 | w->cursor.vpos); | 6677 | = MATRIX_ROW (w->current_matrix, w->cursor.vpos); |
| 6678 | struct glyph_row *desired_cursor_row | ||
| 6679 | = MATRIX_ROW (w->desired_matrix, w->cursor.vpos); | ||
| 6680 | struct glyph_row *cursor_row | ||
| 6681 | = (desired_cursor_row->enabled_p | ||
| 6682 | ? desired_cursor_row | ||
| 6683 | : current_cursor_row); | ||
| 6650 | 6684 | ||
| 6651 | window_box (w, TEXT_AREA, &text_area_x, &text_area_y, | 6685 | window_box (w, TEXT_AREA, &text_area_x, &text_area_y, |
| 6652 | &text_area_width, &text_area_height); | 6686 | &text_area_width, &text_area_height); |
| @@ -6656,7 +6690,8 @@ hscroll_window_tree (window) | |||
| 6656 | 6690 | ||
| 6657 | if ((XFASTINT (w->hscroll) | 6691 | if ((XFASTINT (w->hscroll) |
| 6658 | && w->cursor.x < hscroll_margin) | 6692 | && w->cursor.x < hscroll_margin) |
| 6659 | || (cursor_row->truncated_on_right_p | 6693 | || (cursor_row->enabled_p |
| 6694 | && cursor_row->truncated_on_right_p | ||
| 6660 | && (w->cursor.x > text_area_width - hscroll_margin))) | 6695 | && (w->cursor.x > text_area_width - hscroll_margin))) |
| 6661 | { | 6696 | { |
| 6662 | struct it it; | 6697 | struct it it; |
| @@ -7056,7 +7091,7 @@ redisplay_internal (preserve_echo_area) | |||
| 7056 | && (current_buffer->clip_changed | 7091 | && (current_buffer->clip_changed |
| 7057 | || XFASTINT (w->last_modified) < MODIFF | 7092 | || XFASTINT (w->last_modified) < MODIFF |
| 7058 | || XFASTINT (w->last_overlay_modified) < OVERLAY_MODIFF) | 7093 | || XFASTINT (w->last_overlay_modified) < OVERLAY_MODIFF) |
| 7059 | && resize_mini_window (w)) | 7094 | && resize_mini_window (w, 0)) |
| 7060 | { | 7095 | { |
| 7061 | /* Resized active mini-window to fit the size of what it is | 7096 | /* Resized active mini-window to fit the size of what it is |
| 7062 | showing if its contents might have changed. */ | 7097 | showing if its contents might have changed. */ |
| @@ -7355,13 +7390,31 @@ update: | |||
| 7355 | if (consider_all_windows_p) | 7390 | if (consider_all_windows_p) |
| 7356 | { | 7391 | { |
| 7357 | Lisp_Object tail; | 7392 | Lisp_Object tail; |
| 7393 | struct frame *f; | ||
| 7394 | int hscrolled_p; | ||
| 7358 | 7395 | ||
| 7359 | pause = 0; | 7396 | pause = 0; |
| 7397 | hscrolled_p = 0; | ||
| 7360 | 7398 | ||
| 7399 | /* See if we have to hscroll. */ | ||
| 7361 | for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) | 7400 | for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) |
| 7362 | { | 7401 | if (FRAMEP (XCAR (tail))) |
| 7363 | struct frame *f; | 7402 | { |
| 7403 | f = XFRAME (XCAR (tail)); | ||
| 7404 | |||
| 7405 | if ((FRAME_WINDOW_P (f) | ||
| 7406 | || f == selected_frame) | ||
| 7407 | && FRAME_VISIBLE_P (f) | ||
| 7408 | && !FRAME_OBSCURED_P (f) | ||
| 7409 | && hscroll_windows (f->root_window)) | ||
| 7410 | hscrolled_p = 1; | ||
| 7411 | } | ||
| 7412 | |||
| 7413 | if (hscrolled_p) | ||
| 7414 | goto retry; | ||
| 7364 | 7415 | ||
| 7416 | for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) | ||
| 7417 | { | ||
| 7365 | if (!FRAMEP (XCAR (tail))) | 7418 | if (!FRAMEP (XCAR (tail))) |
| 7366 | continue; | 7419 | continue; |
| 7367 | 7420 | ||
| @@ -7375,9 +7428,6 @@ update: | |||
| 7375 | pause |= update_frame (f, 0, 0); | 7428 | pause |= update_frame (f, 0, 0); |
| 7376 | if (!pause) | 7429 | if (!pause) |
| 7377 | { | 7430 | { |
| 7378 | if (hscroll_windows (f->root_window)) | ||
| 7379 | goto retry; | ||
| 7380 | |||
| 7381 | mark_window_display_accurate (f->root_window, 1); | 7431 | mark_window_display_accurate (f->root_window, 1); |
| 7382 | if (frame_up_to_date_hook != 0) | 7432 | if (frame_up_to_date_hook != 0) |
| 7383 | (*frame_up_to_date_hook) (f); | 7433 | (*frame_up_to_date_hook) (f); |
| @@ -7390,10 +7440,11 @@ update: | |||
| 7390 | if (FRAME_VISIBLE_P (selected_frame) | 7440 | if (FRAME_VISIBLE_P (selected_frame) |
| 7391 | && !FRAME_OBSCURED_P (selected_frame)) | 7441 | && !FRAME_OBSCURED_P (selected_frame)) |
| 7392 | { | 7442 | { |
| 7443 | if (hscroll_windows (selected_window)) | ||
| 7444 | goto retry; | ||
| 7445 | |||
| 7393 | XWINDOW (selected_window)->must_be_updated_p = 1; | 7446 | XWINDOW (selected_window)->must_be_updated_p = 1; |
| 7394 | pause = update_frame (selected_frame, 0, 0); | 7447 | pause = update_frame (selected_frame, 0, 0); |
| 7395 | if (!pause && hscroll_windows (selected_window)) | ||
| 7396 | goto retry; | ||
| 7397 | } | 7448 | } |
| 7398 | else | 7449 | else |
| 7399 | pause = 0; | 7450 | pause = 0; |