diff options
| -rw-r--r-- | src/xdisp.c | 76 |
1 files changed, 32 insertions, 44 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index f277abee47f..b6fe751237f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -8963,6 +8963,8 @@ redisplay_internal (preserve_echo_area) | |||
| 8963 | judge_scroll_bars_hook (f); | 8963 | judge_scroll_bars_hook (f); |
| 8964 | 8964 | ||
| 8965 | /* If fonts changed, display again. */ | 8965 | /* If fonts changed, display again. */ |
| 8966 | /* ??? rms: I suspect it is a mistake to jump all the way | ||
| 8967 | back to retry here. It should just retry this frame. */ | ||
| 8966 | if (fonts_changed_p) | 8968 | if (fonts_changed_p) |
| 8967 | goto retry; | 8969 | goto retry; |
| 8968 | 8970 | ||
| @@ -10098,7 +10100,11 @@ try_cursor_movement (window, startp, scroll_step) | |||
| 10098 | 10100 | ||
| 10099 | 10101 | ||
| 10100 | /* Redisplay leaf window WINDOW. JUST_THIS_ONE_P non-zero means only | 10102 | /* Redisplay leaf window WINDOW. JUST_THIS_ONE_P non-zero means only |
| 10101 | selected_window is redisplayed. */ | 10103 | selected_window is redisplayed. |
| 10104 | |||
| 10105 | We can return without actually redisplaying the window if | ||
| 10106 | fonts_changed_p is nonzero. In that case, redisplay_internal will | ||
| 10107 | retry. */ | ||
| 10102 | 10108 | ||
| 10103 | static void | 10109 | static void |
| 10104 | redisplay_window (window, just_this_one_p) | 10110 | redisplay_window (window, just_this_one_p) |
| @@ -10305,6 +10311,9 @@ redisplay_window (window, just_this_one_p) | |||
| 10305 | if (!NILP (w->force_start) | 10311 | if (!NILP (w->force_start) |
| 10306 | || w->frozen_window_start_p) | 10312 | || w->frozen_window_start_p) |
| 10307 | { | 10313 | { |
| 10314 | /* We set this later on if we have to adjust point. */ | ||
| 10315 | int new_vpos = -1; | ||
| 10316 | |||
| 10308 | w->force_start = Qnil; | 10317 | w->force_start = Qnil; |
| 10309 | w->vscroll = 0; | 10318 | w->vscroll = 0; |
| 10310 | w->window_end_valid = Qnil; | 10319 | w->window_end_valid = Qnil; |
| @@ -10341,7 +10350,7 @@ redisplay_window (window, just_this_one_p) | |||
| 10341 | { | 10350 | { |
| 10342 | w->force_start = Qt; | 10351 | w->force_start = Qt; |
| 10343 | clear_glyph_matrix (w->desired_matrix); | 10352 | clear_glyph_matrix (w->desired_matrix); |
| 10344 | goto finish_scroll_bars; | 10353 | goto need_larger_matrices; |
| 10345 | } | 10354 | } |
| 10346 | 10355 | ||
| 10347 | if (w->cursor.vpos < 0 && !w->frozen_window_start_p) | 10356 | if (w->cursor.vpos < 0 && !w->frozen_window_start_p) |
| @@ -10349,12 +10358,24 @@ redisplay_window (window, just_this_one_p) | |||
| 10349 | /* If point does not appear, try to move point so it does | 10358 | /* If point does not appear, try to move point so it does |
| 10350 | appear. The desired matrix has been built above, so we | 10359 | appear. The desired matrix has been built above, so we |
| 10351 | can use it here. */ | 10360 | can use it here. */ |
| 10352 | int window_height; | 10361 | new_vpos = window_box_height (w) / 2; |
| 10362 | } | ||
| 10363 | |||
| 10364 | if (!make_cursor_line_fully_visible (w)) | ||
| 10365 | { | ||
| 10366 | /* Point does appear, but on a line partly visible at end of window. | ||
| 10367 | Move it back to a fully-visible line. */ | ||
| 10368 | new_vpos = window_box_height (w); | ||
| 10369 | } | ||
| 10370 | |||
| 10371 | /* If we need to move point for either of the above reasons, | ||
| 10372 | now actually do it. */ | ||
| 10373 | if (new_vpos >= 0) | ||
| 10374 | { | ||
| 10353 | struct glyph_row *row; | 10375 | struct glyph_row *row; |
| 10354 | 10376 | ||
| 10355 | window_height = window_box_height (w) / 2; | ||
| 10356 | row = MATRIX_FIRST_TEXT_ROW (w->desired_matrix); | 10377 | row = MATRIX_FIRST_TEXT_ROW (w->desired_matrix); |
| 10357 | while (MATRIX_ROW_BOTTOM_Y (row) < window_height) | 10378 | while (MATRIX_ROW_BOTTOM_Y (row) < new_vpos) |
| 10358 | ++row; | 10379 | ++row; |
| 10359 | 10380 | ||
| 10360 | TEMP_SET_PT_BOTH (MATRIX_ROW_START_CHARPOS (row), | 10381 | TEMP_SET_PT_BOTH (MATRIX_ROW_START_CHARPOS (row), |
| @@ -10378,45 +10399,6 @@ redisplay_window (window, just_this_one_p) | |||
| 10378 | } | 10399 | } |
| 10379 | } | 10400 | } |
| 10380 | 10401 | ||
| 10381 | if (!make_cursor_line_fully_visible (w)) | ||
| 10382 | { | ||
| 10383 | /* CVS rev. 1.761 had changed this to ``goto try_to_scroll''. | ||
| 10384 | |||
| 10385 | The intention of the fix -- AFAIU -- was to ensure that | ||
| 10386 | the cursor didn't end up on a partially visible last (or | ||
| 10387 | first?) line when scrolling. | ||
| 10388 | |||
| 10389 | |||
| 10390 | But that change causes havoc when scrolling backwards and | ||
| 10391 | a partially visible first (or last?) line is present when | ||
| 10392 | we reach the top of the buffer. In effect, the text | ||
| 10393 | already in the window is repeated (each line is appended | ||
| 10394 | to the same or another lines in the window)... | ||
| 10395 | |||
| 10396 | I changed it back to ``goto need_larger_matrices'' which | ||
| 10397 | in effect mean that we don't go through `try_scrolling' | ||
| 10398 | when the cursor is already at the first line of the buffer, | ||
| 10399 | and there is really only a few pixels [rather than lines] | ||
| 10400 | to scroll backwards. I guess move_it_by_lines etc. really | ||
| 10401 | isn't the right device for doing that, ref. the code in | ||
| 10402 | make_cursor_line_fully_visible which was also disabled by | ||
| 10403 | CVS rev. 1.761. | ||
| 10404 | |||
| 10405 | But how do we know that we are already on the top line of | ||
| 10406 | the window showing the first line in the buffer, so that | ||
| 10407 | scrolling really wont help here? | ||
| 10408 | |||
| 10409 | I cannot find a simple fix for this (I tried various | ||
| 10410 | approaches), but I prefer to an occasional partial line | ||
| 10411 | rather than the visual messup, so I reverted this part of | ||
| 10412 | the fix. | ||
| 10413 | |||
| 10414 | Someone will need to look into this when time allows. | ||
| 10415 | |||
| 10416 | -- 2002-08-22, Kim F. Storm */ | ||
| 10417 | |||
| 10418 | goto need_larger_matrices; | ||
| 10419 | } | ||
| 10420 | #if GLYPH_DEBUG | 10402 | #if GLYPH_DEBUG |
| 10421 | debug_method_add (w, "forced window start"); | 10403 | debug_method_add (w, "forced window start"); |
| 10422 | #endif | 10404 | #endif |
| @@ -10435,8 +10417,10 @@ redisplay_window (window, just_this_one_p) | |||
| 10435 | case CURSOR_MOVEMENT_SUCCESS: | 10417 | case CURSOR_MOVEMENT_SUCCESS: |
| 10436 | goto done; | 10418 | goto done; |
| 10437 | 10419 | ||
| 10420 | #if 0 /* try_cursor_movement never returns this value. */ | ||
| 10438 | case CURSOR_MOVEMENT_NEED_LARGER_MATRICES: | 10421 | case CURSOR_MOVEMENT_NEED_LARGER_MATRICES: |
| 10439 | goto need_larger_matrices; | 10422 | goto need_larger_matrices; |
| 10423 | #endif | ||
| 10440 | 10424 | ||
| 10441 | case CURSOR_MOVEMENT_MUST_SCROLL: | 10425 | case CURSOR_MOVEMENT_MUST_SCROLL: |
| 10442 | goto try_to_scroll; | 10426 | goto try_to_scroll; |
| @@ -10765,6 +10749,10 @@ redisplay_window (window, just_this_one_p) | |||
| 10765 | #endif | 10749 | #endif |
| 10766 | } | 10750 | } |
| 10767 | 10751 | ||
| 10752 | /* We go to this label, with fonts_changed_p nonzero, | ||
| 10753 | if it is necessary to try again using larger glyph matrices. | ||
| 10754 | We have to redeem the scroll bar even in this case, | ||
| 10755 | because the loop in redisplay_internal expects that. */ | ||
| 10768 | need_larger_matrices: | 10756 | need_larger_matrices: |
| 10769 | ; | 10757 | ; |
| 10770 | finish_scroll_bars: | 10758 | finish_scroll_bars: |