Mercurial > emacs
comparison src/xdisp.c @ 39449:e0fb6798db26
(make_cursor_line_fully_visible): Return 0 and set
fonts_changed_p if need larger matrices due to vscrolling.
(try_scrolling, try_cursor_movement, redisplay_window): Give up on
this round of redisplay if make_cursor_line_fully_visible fails.
(CURSOR_MOVEMENT_*, SCROLLING_*): New enumerators.
(try_cursor_movement, try_scrolling): Use them instead of
integers.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Wed, 26 Sep 2001 11:27:06 +0000 |
parents | 880534cbcad7 |
children | 6e2cada77836 |
comparison
equal
deleted
inserted
replaced
39448:b74c165ef22f | 39449:e0fb6798db26 |
---|---|
706 static Lisp_Object safe_eval_handler P_ ((Lisp_Object)); | 706 static Lisp_Object safe_eval_handler P_ ((Lisp_Object)); |
707 static void insert_left_trunc_glyphs P_ ((struct it *)); | 707 static void insert_left_trunc_glyphs P_ ((struct it *)); |
708 static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *)); | 708 static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *)); |
709 static void extend_face_to_end_of_line P_ ((struct it *)); | 709 static void extend_face_to_end_of_line P_ ((struct it *)); |
710 static int append_space P_ ((struct it *, int)); | 710 static int append_space P_ ((struct it *, int)); |
711 static void make_cursor_line_fully_visible P_ ((struct window *)); | 711 static int make_cursor_line_fully_visible P_ ((struct window *)); |
712 static int try_scrolling P_ ((Lisp_Object, int, int, int, int)); | 712 static int try_scrolling P_ ((Lisp_Object, int, int, int, int)); |
713 static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *)); | 713 static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *)); |
714 static int trailing_whitespace_p P_ ((int)); | 714 static int trailing_whitespace_p P_ ((int)); |
715 static int message_log_check_duplicate P_ ((int, int, int, int)); | 715 static int message_log_check_duplicate P_ ((int, int, int, int)); |
716 int invisible_p P_ ((Lisp_Object, Lisp_Object)); | 716 int invisible_p P_ ((Lisp_Object, Lisp_Object)); |
9282 return startp; | 9282 return startp; |
9283 } | 9283 } |
9284 | 9284 |
9285 | 9285 |
9286 /* Modify the desired matrix of window W and W->vscroll so that the | 9286 /* Modify the desired matrix of window W and W->vscroll so that the |
9287 line containing the cursor is fully visible. */ | 9287 line containing the cursor is fully visible. If this requires |
9288 | 9288 larger matrices than are allocated, set fonts_changed_p and return |
9289 static void | 9289 0. */ |
9290 | |
9291 static int | |
9290 make_cursor_line_fully_visible (w) | 9292 make_cursor_line_fully_visible (w) |
9291 struct window *w; | 9293 struct window *w; |
9292 { | 9294 { |
9293 struct glyph_matrix *matrix; | 9295 struct glyph_matrix *matrix; |
9294 struct glyph_row *row; | 9296 struct glyph_row *row; |
9295 int window_height; | 9297 int window_height; |
9296 | 9298 |
9297 /* It's not always possible to find the cursor, e.g, when a window | 9299 /* It's not always possible to find the cursor, e.g, when a window |
9298 is full of overlay strings. Don't do anything in that case. */ | 9300 is full of overlay strings. Don't do anything in that case. */ |
9299 if (w->cursor.vpos < 0) | 9301 if (w->cursor.vpos < 0) |
9300 return; | 9302 return 1; |
9301 | 9303 |
9302 matrix = w->desired_matrix; | 9304 matrix = w->desired_matrix; |
9303 row = MATRIX_ROW (matrix, w->cursor.vpos); | 9305 row = MATRIX_ROW (matrix, w->cursor.vpos); |
9304 | 9306 |
9305 /* If the cursor row is not partially visible, there's nothing | 9307 /* If the cursor row is not partially visible, there's nothing |
9306 to do. */ | 9308 to do. */ |
9307 if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (row)) | 9309 if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (row)) |
9308 return; | 9310 return 1; |
9309 | 9311 |
9310 /* If the row the cursor is in is taller than the window's height, | 9312 /* If the row the cursor is in is taller than the window's height, |
9311 it's not clear what to do, so do nothing. */ | 9313 it's not clear what to do, so do nothing. */ |
9312 window_height = window_box_height (w); | 9314 window_height = window_box_height (w); |
9313 if (row->height >= window_height) | 9315 if (row->height >= window_height) |
9314 return; | 9316 return 1; |
9315 | 9317 |
9316 if (MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row)) | 9318 if (MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row)) |
9317 { | 9319 { |
9318 int dy = row->height - row->visible_height; | 9320 int dy = row->height - row->visible_height; |
9319 w->vscroll = 0; | 9321 w->vscroll = 0; |
9332 change this_line_y as well so that the display optimization for | 9334 change this_line_y as well so that the display optimization for |
9333 the cursor line of the selected window in redisplay_internal uses | 9335 the cursor line of the selected window in redisplay_internal uses |
9334 the correct y-position. */ | 9336 the correct y-position. */ |
9335 if (w == XWINDOW (selected_window)) | 9337 if (w == XWINDOW (selected_window)) |
9336 this_line_y = w->cursor.y; | 9338 this_line_y = w->cursor.y; |
9339 | |
9340 /* If vscrolling requires a larger glyph matrix, arrange for a fresh | |
9341 redisplay with larger matrices. */ | |
9342 if (matrix->nrows < required_matrix_height (w)) | |
9343 { | |
9344 fonts_changed_p = 1; | |
9345 return 0; | |
9346 } | |
9347 | |
9348 return 1; | |
9337 } | 9349 } |
9338 | 9350 |
9339 | 9351 |
9340 /* Try scrolling PT into view in window WINDOW. JUST_THIS_ONE_P | 9352 /* Try scrolling PT into view in window WINDOW. JUST_THIS_ONE_P |
9341 non-zero means only WINDOW is redisplayed in redisplay_internal. | 9353 non-zero means only WINDOW is redisplayed in redisplay_internal. |
9349 | 9361 |
9350 0 if scrolling didn't find point. | 9362 0 if scrolling didn't find point. |
9351 | 9363 |
9352 -1 if new fonts have been loaded so that we must interrupt | 9364 -1 if new fonts have been loaded so that we must interrupt |
9353 redisplay, adjust glyph matrices, and try again. */ | 9365 redisplay, adjust glyph matrices, and try again. */ |
9366 | |
9367 enum | |
9368 { | |
9369 SCROLLING_SUCCESS, | |
9370 SCROLLING_FAILED, | |
9371 SCROLLING_NEED_LARGER_MATRICES | |
9372 }; | |
9354 | 9373 |
9355 static int | 9374 static int |
9356 try_scrolling (window, just_this_one_p, scroll_conservatively, | 9375 try_scrolling (window, just_this_one_p, scroll_conservatively, |
9357 scroll_step, temp_scroll_step) | 9376 scroll_step, temp_scroll_step) |
9358 Lisp_Object window; | 9377 Lisp_Object window; |
9439 scroll a line to make PT visible. That's the reason why 1 is | 9458 scroll a line to make PT visible. That's the reason why 1 is |
9440 added below. */ | 9459 added below. */ |
9441 dy = 1 + it.current_y - y0; | 9460 dy = 1 + it.current_y - y0; |
9442 | 9461 |
9443 if (dy > scroll_max) | 9462 if (dy > scroll_max) |
9444 return 0; | 9463 return SCROLLING_FAILED; |
9445 | 9464 |
9446 /* Move the window start down. If scrolling conservatively, | 9465 /* Move the window start down. If scrolling conservatively, |
9447 move it just enough down to make point visible. If | 9466 move it just enough down to make point visible. If |
9448 scroll_step is set, move it down by scroll_step. */ | 9467 scroll_step is set, move it down by scroll_step. */ |
9449 start_display (&it, w, startp); | 9468 start_display (&it, w, startp); |
9462 if (NUMBERP (aggressive)) | 9481 if (NUMBERP (aggressive)) |
9463 amount_to_scroll = XFLOATINT (aggressive) * height; | 9482 amount_to_scroll = XFLOATINT (aggressive) * height; |
9464 } | 9483 } |
9465 | 9484 |
9466 if (amount_to_scroll <= 0) | 9485 if (amount_to_scroll <= 0) |
9467 return 0; | 9486 return SCROLLING_FAILED; |
9468 | 9487 |
9469 move_it_vertically (&it, amount_to_scroll); | 9488 move_it_vertically (&it, amount_to_scroll); |
9470 startp = it.current.pos; | 9489 startp = it.current.pos; |
9471 } | 9490 } |
9472 else | 9491 else |
9496 move_it_to (&it, CHARPOS (scroll_margin_pos), 0, | 9515 move_it_to (&it, CHARPOS (scroll_margin_pos), 0, |
9497 it.last_visible_y, -1, | 9516 it.last_visible_y, -1, |
9498 MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); | 9517 MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); |
9499 dy = it.current_y - y0; | 9518 dy = it.current_y - y0; |
9500 if (dy > scroll_max) | 9519 if (dy > scroll_max) |
9501 return 0; | 9520 return SCROLLING_FAILED; |
9502 | 9521 |
9503 /* Compute new window start. */ | 9522 /* Compute new window start. */ |
9504 start_display (&it, w, startp); | 9523 start_display (&it, w, startp); |
9505 | 9524 |
9506 if (scroll_conservatively) | 9525 if (scroll_conservatively) |
9516 if (NUMBERP (aggressive)) | 9535 if (NUMBERP (aggressive)) |
9517 amount_to_scroll = XFLOATINT (aggressive) * height; | 9536 amount_to_scroll = XFLOATINT (aggressive) * height; |
9518 } | 9537 } |
9519 | 9538 |
9520 if (amount_to_scroll <= 0) | 9539 if (amount_to_scroll <= 0) |
9521 return 0; | 9540 return SCROLLING_FAILED; |
9522 | 9541 |
9523 move_it_vertically (&it, - amount_to_scroll); | 9542 move_it_vertically (&it, - amount_to_scroll); |
9524 startp = it.current.pos; | 9543 startp = it.current.pos; |
9525 } | 9544 } |
9526 } | 9545 } |
9529 startp = run_window_scroll_functions (window, startp); | 9548 startp = run_window_scroll_functions (window, startp); |
9530 | 9549 |
9531 /* Display the window. Give up if new fonts are loaded, or if point | 9550 /* Display the window. Give up if new fonts are loaded, or if point |
9532 doesn't appear. */ | 9551 doesn't appear. */ |
9533 if (!try_window (window, startp)) | 9552 if (!try_window (window, startp)) |
9534 rc = -1; | 9553 rc = SCROLLING_NEED_LARGER_MATRICES; |
9535 else if (w->cursor.vpos < 0) | 9554 else if (w->cursor.vpos < 0) |
9536 { | 9555 { |
9537 clear_glyph_matrix (w->desired_matrix); | 9556 clear_glyph_matrix (w->desired_matrix); |
9538 rc = 0; | 9557 rc = SCROLLING_FAILED; |
9539 } | 9558 } |
9540 else | 9559 else |
9541 { | 9560 { |
9542 /* Maybe forget recorded base line for line number display. */ | 9561 /* Maybe forget recorded base line for line number display. */ |
9543 if (!just_this_one_p | 9562 if (!just_this_one_p |
9544 || current_buffer->clip_changed | 9563 || current_buffer->clip_changed |
9545 || BEG_UNCHANGED < CHARPOS (startp)) | 9564 || BEG_UNCHANGED < CHARPOS (startp)) |
9546 w->base_line_number = Qnil; | 9565 w->base_line_number = Qnil; |
9547 | 9566 |
9548 /* If cursor ends up on a partially visible line, shift display | 9567 /* If cursor ends up on a partially visible line, shift display |
9549 lines up or down. */ | 9568 lines up or down. If that fails because we need larger |
9550 make_cursor_line_fully_visible (w); | 9569 matrices, give up. */ |
9551 rc = 1; | 9570 if (!make_cursor_line_fully_visible (w)) |
9571 rc = SCROLLING_NEED_LARGER_MATRICES; | |
9572 else | |
9573 rc = SCROLLING_SUCCESS; | |
9552 } | 9574 } |
9553 | 9575 |
9554 return rc; | 9576 return rc; |
9555 } | 9577 } |
9556 | 9578 |
9628 | 9650 |
9629 | 9651 |
9630 /* Try cursor movement in case text has not changes in window WINDOW, | 9652 /* Try cursor movement in case text has not changes in window WINDOW, |
9631 with window start STARTP. Value is | 9653 with window start STARTP. Value is |
9632 | 9654 |
9633 1 if successful | 9655 CURSOR_MOVEMENT_SUCCESS if successful |
9634 | 9656 |
9635 0 if this method cannot be used | 9657 CURSOR_MOVEMENT_CANNOT_BE_USED if this method cannot be used |
9636 | 9658 |
9637 -1 if we know we have to scroll the display. *SCROLL_STEP is | 9659 CURSOR_MOVEMENT_MUST_SCROLL if we know we have to scroll the |
9638 set to 1, under certain circumstances, if we want to scroll as | 9660 display. *SCROLL_STEP is set to 1, under certain circumstances, if |
9639 if scroll-step were set to 1. See the code. */ | 9661 we want to scroll as if scroll-step were set to 1. See the code. |
9662 | |
9663 CURSOR_MOVEMENT_NEED_LARGER_MATRICES if we need larger matrices, in | |
9664 which case we have to abort this redisplay, and adjust matrices | |
9665 first. */ | |
9666 | |
9667 enum | |
9668 { | |
9669 CURSOR_MOVEMENT_SUCCESS, | |
9670 CURSOR_MOVEMENT_CANNOT_BE_USED, | |
9671 CURSOR_MOVEMENT_MUST_SCROLL, | |
9672 CURSOR_MOVEMENT_NEED_LARGER_MATRICES | |
9673 }; | |
9640 | 9674 |
9641 static int | 9675 static int |
9642 try_cursor_movement (window, startp, scroll_step) | 9676 try_cursor_movement (window, startp, scroll_step) |
9643 Lisp_Object window; | 9677 Lisp_Object window; |
9644 struct text_pos startp; | 9678 struct text_pos startp; |
9645 int *scroll_step; | 9679 int *scroll_step; |
9646 { | 9680 { |
9647 struct window *w = XWINDOW (window); | 9681 struct window *w = XWINDOW (window); |
9648 struct frame *f = XFRAME (w->frame); | 9682 struct frame *f = XFRAME (w->frame); |
9649 int rc = 0; | 9683 int rc = CURSOR_MOVEMENT_CANNOT_BE_USED; |
9650 | 9684 |
9651 /* Handle case where text has not changed, only point, and it has | 9685 /* Handle case where text has not changed, only point, and it has |
9652 not moved off the frame. */ | 9686 not moved off the frame. */ |
9653 if (/* Point may be in this window. */ | 9687 if (/* Point may be in this window. */ |
9654 PT >= CHARPOS (startp) | 9688 PT >= CHARPOS (startp) |
9702 | 9736 |
9703 /* Start with the row the cursor was displayed during the last | 9737 /* Start with the row the cursor was displayed during the last |
9704 not paused redisplay. Give up if that row is not valid. */ | 9738 not paused redisplay. Give up if that row is not valid. */ |
9705 if (w->last_cursor.vpos < 0 | 9739 if (w->last_cursor.vpos < 0 |
9706 || w->last_cursor.vpos >= w->current_matrix->nrows) | 9740 || w->last_cursor.vpos >= w->current_matrix->nrows) |
9707 rc = -1; | 9741 rc = CURSOR_MOVEMENT_MUST_SCROLL; |
9708 else | 9742 else |
9709 { | 9743 { |
9710 row = MATRIX_ROW (w->current_matrix, w->last_cursor.vpos); | 9744 row = MATRIX_ROW (w->current_matrix, w->last_cursor.vpos); |
9711 if (row->mode_line_p) | 9745 if (row->mode_line_p) |
9712 ++row; | 9746 ++row; |
9713 if (!row->enabled_p) | 9747 if (!row->enabled_p) |
9714 rc = -1; | 9748 rc = CURSOR_MOVEMENT_MUST_SCROLL; |
9715 } | 9749 } |
9716 | 9750 |
9717 if (rc == 0) | 9751 if (rc == CURSOR_MOVEMENT_CANNOT_BE_USED) |
9718 { | 9752 { |
9719 int scroll_p = 0; | 9753 int scroll_p = 0; |
9720 int last_y = window_text_bottom_y (w) - this_scroll_margin; | 9754 int last_y = window_text_bottom_y (w) - this_scroll_margin; |
9721 | 9755 |
9722 if (PT > XFASTINT (w->last_point)) | 9756 if (PT > XFASTINT (w->last_point)) |
9795 | 9829 |
9796 if (PT < MATRIX_ROW_START_CHARPOS (row) | 9830 if (PT < MATRIX_ROW_START_CHARPOS (row) |
9797 || PT > MATRIX_ROW_END_CHARPOS (row)) | 9831 || PT > MATRIX_ROW_END_CHARPOS (row)) |
9798 { | 9832 { |
9799 /* if PT is not in the glyph row, give up. */ | 9833 /* if PT is not in the glyph row, give up. */ |
9800 rc = -1; | 9834 rc = CURSOR_MOVEMENT_MUST_SCROLL; |
9801 } | 9835 } |
9802 else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (row)) | 9836 else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (row)) |
9803 { | 9837 { |
9804 if (PT == MATRIX_ROW_END_CHARPOS (row) | 9838 if (PT == MATRIX_ROW_END_CHARPOS (row) |
9805 && !row->ends_at_zv_p | 9839 && !row->ends_at_zv_p |
9806 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)) | 9840 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)) |
9807 rc = -1; | 9841 rc = CURSOR_MOVEMENT_MUST_SCROLL; |
9808 else if (row->height > window_box_height (w)) | 9842 else if (row->height > window_box_height (w)) |
9809 { | 9843 { |
9810 /* If we end up in a partially visible line, let's | 9844 /* If we end up in a partially visible line, let's |
9811 make it fully visible, except when it's taller | 9845 make it fully visible, except when it's taller |
9812 than the window, in which case we can't do much | 9846 than the window, in which case we can't do much |
9813 about it. */ | 9847 about it. */ |
9814 *scroll_step = 1; | 9848 *scroll_step = 1; |
9815 rc = -1; | 9849 rc = CURSOR_MOVEMENT_MUST_SCROLL; |
9816 } | 9850 } |
9817 else | 9851 else |
9818 { | 9852 { |
9819 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); | 9853 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); |
9820 try_window (window, startp); | 9854 try_window (window, startp); |
9821 make_cursor_line_fully_visible (w); | 9855 if (!make_cursor_line_fully_visible (w)) |
9822 rc = 1; | 9856 rc = CURSOR_MOVEMENT_NEED_LARGER_MATRICES; |
9857 else | |
9858 rc = CURSOR_MOVEMENT_SUCCESS; | |
9823 } | 9859 } |
9824 } | 9860 } |
9825 else if (scroll_p) | 9861 else if (scroll_p) |
9826 rc = -1; | 9862 rc = CURSOR_MOVEMENT_MUST_SCROLL; |
9827 else | 9863 else |
9828 { | 9864 { |
9829 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); | 9865 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); |
9830 rc = 1; | 9866 rc = CURSOR_MOVEMENT_SUCCESS; |
9831 } | 9867 } |
9832 } | 9868 } |
9833 } | 9869 } |
9834 | 9870 |
9835 return rc; | 9871 return rc; |
10099 if (!NILP (Vtransient_mark_mode) | 10135 if (!NILP (Vtransient_mark_mode) |
10100 && !NILP (current_buffer->mark_active)) | 10136 && !NILP (current_buffer->mark_active)) |
10101 { | 10137 { |
10102 clear_glyph_matrix (w->desired_matrix); | 10138 clear_glyph_matrix (w->desired_matrix); |
10103 if (!try_window (window, startp)) | 10139 if (!try_window (window, startp)) |
10104 goto finish_scroll_bars; | 10140 goto need_larger_matrices; |
10105 } | 10141 } |
10106 } | 10142 } |
10107 | 10143 |
10108 make_cursor_line_fully_visible (w); | 10144 if (!make_cursor_line_fully_visible (w)) |
10145 goto need_larger_matrices; | |
10109 #if GLYPH_DEBUG | 10146 #if GLYPH_DEBUG |
10110 debug_method_add (w, "forced window start"); | 10147 debug_method_add (w, "forced window start"); |
10111 #endif | 10148 #endif |
10112 goto done; | 10149 goto done; |
10113 } | 10150 } |
10114 | 10151 |
10115 /* Handle case where text has not changed, only point, and it has | 10152 /* Handle case where text has not changed, only point, and it has |
10116 not moved off the frame. */ | 10153 not moved off the frame. */ |
10117 if (current_matrix_up_to_date_p | 10154 if (current_matrix_up_to_date_p |
10118 && (rc = try_cursor_movement (window, startp, &temp_scroll_step), | 10155 && (rc = try_cursor_movement (window, startp, &temp_scroll_step), |
10119 rc != 0)) | 10156 rc != CURSOR_MOVEMENT_CANNOT_BE_USED)) |
10120 { | 10157 { |
10121 if (rc == -1) | 10158 switch (rc) |
10122 goto try_to_scroll; | 10159 { |
10123 else | 10160 case CURSOR_MOVEMENT_SUCCESS: |
10124 goto done; | 10161 goto done; |
10162 | |
10163 case CURSOR_MOVEMENT_NEED_LARGER_MATRICES: | |
10164 goto need_larger_matrices; | |
10165 | |
10166 case CURSOR_MOVEMENT_MUST_SCROLL: | |
10167 goto try_to_scroll; | |
10168 | |
10169 default: | |
10170 abort (); | |
10171 } | |
10125 } | 10172 } |
10126 /* If current starting point was originally the beginning of a line | 10173 /* If current starting point was originally the beginning of a line |
10127 but no longer is, find a new starting point. */ | 10174 but no longer is, find a new starting point. */ |
10128 else if (!NILP (w->start_at_line_beg) | 10175 else if (!NILP (w->start_at_line_beg) |
10129 && !(CHARPOS (startp) <= BEGV | 10176 && !(CHARPOS (startp) <= BEGV |
10143 #if GLYPH_DEBUG | 10190 #if GLYPH_DEBUG |
10144 debug_method_add (w, "try_window_id %d", tem); | 10191 debug_method_add (w, "try_window_id %d", tem); |
10145 #endif | 10192 #endif |
10146 | 10193 |
10147 if (fonts_changed_p) | 10194 if (fonts_changed_p) |
10148 goto finish_scroll_bars; | 10195 goto need_larger_matrices; |
10149 if (tem > 0) | 10196 if (tem > 0) |
10150 goto done; | 10197 goto done; |
10151 | 10198 |
10152 /* Otherwise try_window_id has returned -1 which means that we | 10199 /* Otherwise try_window_id has returned -1 which means that we |
10153 don't want the alternative below this comment to execute. */ | 10200 don't want the alternative below this comment to execute. */ |
10178 IF_DEBUG (debug_method_add (w, "1")); | 10225 IF_DEBUG (debug_method_add (w, "1")); |
10179 try_window (window, startp); | 10226 try_window (window, startp); |
10180 } | 10227 } |
10181 | 10228 |
10182 if (fonts_changed_p) | 10229 if (fonts_changed_p) |
10183 goto finish_scroll_bars; | 10230 goto need_larger_matrices; |
10184 | 10231 |
10185 if (w->cursor.vpos >= 0) | 10232 if (w->cursor.vpos >= 0) |
10186 { | 10233 { |
10187 if (!just_this_one_p | 10234 if (!just_this_one_p |
10188 || current_buffer->clip_changed | 10235 || current_buffer->clip_changed |
10189 || BEG_UNCHANGED < CHARPOS (startp)) | 10236 || BEG_UNCHANGED < CHARPOS (startp)) |
10190 /* Forget any recorded base line for line number display. */ | 10237 /* Forget any recorded base line for line number display. */ |
10191 w->base_line_number = Qnil; | 10238 w->base_line_number = Qnil; |
10192 | 10239 |
10193 make_cursor_line_fully_visible (w); | 10240 if (!make_cursor_line_fully_visible (w)) |
10241 goto need_larger_matrices; | |
10194 goto done; | 10242 goto done; |
10195 } | 10243 } |
10196 else | 10244 else |
10197 clear_glyph_matrix (w->desired_matrix); | 10245 clear_glyph_matrix (w->desired_matrix); |
10198 } | 10246 } |
10223 successful, 0 if not successful. */ | 10271 successful, 0 if not successful. */ |
10224 int rc = try_scrolling (window, just_this_one_p, | 10272 int rc = try_scrolling (window, just_this_one_p, |
10225 scroll_conservatively, | 10273 scroll_conservatively, |
10226 scroll_step, | 10274 scroll_step, |
10227 temp_scroll_step); | 10275 temp_scroll_step); |
10228 if (rc > 0) | 10276 switch (rc) |
10229 goto done; | 10277 { |
10230 else if (rc < 0) | 10278 case SCROLLING_SUCCESS: |
10231 goto finish_scroll_bars; | 10279 goto done; |
10280 | |
10281 case SCROLLING_NEED_LARGER_MATRICES: | |
10282 goto need_larger_matrices; | |
10283 | |
10284 case SCROLLING_FAILED: | |
10285 break; | |
10286 | |
10287 default: | |
10288 abort (); | |
10289 } | |
10232 } | 10290 } |
10233 | 10291 |
10234 /* Finally, just choose place to start which centers point */ | 10292 /* Finally, just choose place to start which centers point */ |
10235 | 10293 |
10236 recenter: | 10294 recenter: |
10287 | 10345 |
10288 /* If new fonts have been loaded (due to fontsets), give up. We | 10346 /* If new fonts have been loaded (due to fontsets), give up. We |
10289 have to start a new redisplay since we need to re-adjust glyph | 10347 have to start a new redisplay since we need to re-adjust glyph |
10290 matrices. */ | 10348 matrices. */ |
10291 if (fonts_changed_p) | 10349 if (fonts_changed_p) |
10292 goto finish_scroll_bars; | 10350 goto need_larger_matrices; |
10293 | 10351 |
10294 /* If cursor did not appear assume that the middle of the window is | 10352 /* If cursor did not appear assume that the middle of the window is |
10295 in the first line of the window. Do it again with the next line. | 10353 in the first line of the window. Do it again with the next line. |
10296 (Imagine a window of height 100, displaying two lines of height | 10354 (Imagine a window of height 100, displaying two lines of height |
10297 60. Moving back 50 from it->last_visible_y will end in the first | 10355 60. Moving back 50 from it->last_visible_y will end in the first |
10327 if (row->mode_line_p) | 10385 if (row->mode_line_p) |
10328 ++row; | 10386 ++row; |
10329 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); | 10387 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); |
10330 } | 10388 } |
10331 | 10389 |
10332 make_cursor_line_fully_visible (w); | 10390 if (!make_cursor_line_fully_visible (w)) |
10391 goto need_larger_matrices; | |
10333 | 10392 |
10334 done: | 10393 done: |
10335 | 10394 |
10336 SET_TEXT_POS_FROM_MARKER (startp, w->start); | 10395 SET_TEXT_POS_FROM_MARKER (startp, w->start); |
10337 w->start_at_line_beg = ((CHARPOS (startp) == BEGV | 10396 w->start_at_line_beg = ((CHARPOS (startp) == BEGV |
10377 MATRIX_HEADER_LINE_ROW (w->current_matrix)->height | 10436 MATRIX_HEADER_LINE_ROW (w->current_matrix)->height |
10378 = DESIRED_HEADER_LINE_HEIGHT (w); | 10437 = DESIRED_HEADER_LINE_HEIGHT (w); |
10379 } | 10438 } |
10380 | 10439 |
10381 if (fonts_changed_p) | 10440 if (fonts_changed_p) |
10382 goto finish_scroll_bars; | 10441 goto need_larger_matrices; |
10383 } | 10442 } |
10384 | 10443 |
10385 if (!line_number_displayed | 10444 if (!line_number_displayed |
10386 && !BUFFERP (w->base_line_pos)) | 10445 && !BUFFERP (w->base_line_pos)) |
10387 { | 10446 { |
10417 || auto_resize_tool_bars_p)) | 10476 || auto_resize_tool_bars_p)) |
10418 redisplay_tool_bar (f); | 10477 redisplay_tool_bar (f); |
10419 #endif | 10478 #endif |
10420 } | 10479 } |
10421 | 10480 |
10481 need_larger_matrices: | |
10482 ; | |
10422 finish_scroll_bars: | 10483 finish_scroll_bars: |
10423 | 10484 |
10424 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) | 10485 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
10425 { | 10486 { |
10426 int start, end, whole; | 10487 int start, end, whole; |