diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index c56cffa951d..a82736ccd18 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -9788,11 +9788,13 @@ try_window_reusing_current_matrix (w) | |||
| 9788 | 9788 | ||
| 9789 | /* Display up to a row that can be reused. The variable | 9789 | /* Display up to a row that can be reused. The variable |
| 9790 | last_text_row is set to the last row displayed that displays | 9790 | last_text_row is set to the last row displayed that displays |
| 9791 | text. */ | 9791 | text. Note that it.vpos == 0 if or if not there is a |
| 9792 | header-line; it's not the same as the MATRIX_ROW_VPOS! */ | ||
| 9792 | start_display (&it, w, new_start); | 9793 | start_display (&it, w, new_start); |
| 9793 | first_row_y = it.current_y; | 9794 | first_row_y = it.current_y; |
| 9794 | w->cursor.vpos = -1; | 9795 | w->cursor.vpos = -1; |
| 9795 | last_text_row = last_reused_text_row = NULL; | 9796 | last_text_row = last_reused_text_row = NULL; |
| 9797 | |||
| 9796 | while (it.current_y < it.last_visible_y | 9798 | while (it.current_y < it.last_visible_y |
| 9797 | && IT_CHARPOS (it) < CHARPOS (start) | 9799 | && IT_CHARPOS (it) < CHARPOS (start) |
| 9798 | && !fonts_changed_p) | 9800 | && !fonts_changed_p) |
| @@ -9804,6 +9806,7 @@ try_window_reusing_current_matrix (w) | |||
| 9804 | have at least one reusable row. */ | 9806 | have at least one reusable row. */ |
| 9805 | if (it.current_y < it.last_visible_y) | 9807 | if (it.current_y < it.last_visible_y) |
| 9806 | { | 9808 | { |
| 9809 | /* IT.vpos always starts from 0; it counts text lines. */ | ||
| 9807 | nrows_scrolled = it.vpos; | 9810 | nrows_scrolled = it.vpos; |
| 9808 | 9811 | ||
| 9809 | /* Find PT if not already found in the lines displayed. */ | 9812 | /* Find PT if not already found in the lines displayed. */ |
| @@ -9847,8 +9850,8 @@ try_window_reusing_current_matrix (w) | |||
| 9847 | run.current_y = first_row_y; | 9850 | run.current_y = first_row_y; |
| 9848 | run.desired_y = it.current_y; | 9851 | run.desired_y = it.current_y; |
| 9849 | run.height = it.last_visible_y - it.current_y; | 9852 | run.height = it.last_visible_y - it.current_y; |
| 9850 | if (run.height > 0 | 9853 | |
| 9851 | && run.current_y != run.desired_y) | 9854 | if (run.height > 0 && run.current_y != run.desired_y) |
| 9852 | { | 9855 | { |
| 9853 | update_begin (f); | 9856 | update_begin (f); |
| 9854 | rif->update_window_begin_hook (w); | 9857 | rif->update_window_begin_hook (w); |
| @@ -9867,13 +9870,14 @@ try_window_reusing_current_matrix (w) | |||
| 9867 | 9870 | ||
| 9868 | /* Disable lines not reused. */ | 9871 | /* Disable lines not reused. */ |
| 9869 | for (i = 0; i < it.vpos; ++i) | 9872 | for (i = 0; i < it.vpos; ++i) |
| 9870 | MATRIX_ROW (w->current_matrix, i)->enabled_p = 0; | 9873 | (start_row + i)->enabled_p = 0; |
| 9871 | 9874 | ||
| 9872 | /* Re-compute Y positions. */ | 9875 | /* Re-compute Y positions. */ |
| 9873 | row = MATRIX_FIRST_TEXT_ROW (w->current_matrix) + nrows_scrolled; | ||
| 9874 | min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | 9876 | min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); |
| 9875 | max_y = it.last_visible_y; | 9877 | max_y = it.last_visible_y; |
| 9876 | while (row < bottom_row) | 9878 | for (row = start_row + nrows_scrolled; |
| 9879 | row < bottom_row; | ||
| 9880 | ++row) | ||
| 9877 | { | 9881 | { |
| 9878 | row->y = it.current_y; | 9882 | row->y = it.current_y; |
| 9879 | 9883 | ||
| @@ -9886,13 +9890,11 @@ try_window_reusing_current_matrix (w) | |||
| 9886 | row->visible_height = row->height; | 9890 | row->visible_height = row->height; |
| 9887 | 9891 | ||
| 9888 | it.current_y += row->height; | 9892 | it.current_y += row->height; |
| 9889 | ++it.vpos; | ||
| 9890 | 9893 | ||
| 9891 | if (MATRIX_ROW_DISPLAYS_TEXT_P (row)) | 9894 | if (MATRIX_ROW_DISPLAYS_TEXT_P (row)) |
| 9892 | last_reused_text_row = row; | 9895 | last_reused_text_row = row; |
| 9893 | if (MATRIX_ROW_BOTTOM_Y (row) >= it.last_visible_y) | 9896 | if (MATRIX_ROW_BOTTOM_Y (row) >= it.last_visible_y) |
| 9894 | break; | 9897 | break; |
| 9895 | ++row; | ||
| 9896 | } | 9898 | } |
| 9897 | } | 9899 | } |
| 9898 | 9900 | ||
| @@ -9948,7 +9950,7 @@ try_window_reusing_current_matrix (w) | |||
| 9948 | 9950 | ||
| 9949 | /* Find the row starting at new_start, if there is one. Don't | 9951 | /* Find the row starting at new_start, if there is one. Don't |
| 9950 | reuse a partially visible line at the end. */ | 9952 | reuse a partially visible line at the end. */ |
| 9951 | first_reusable_row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | 9953 | first_reusable_row = start_row; |
| 9952 | while (first_reusable_row->enabled_p | 9954 | while (first_reusable_row->enabled_p |
| 9953 | && MATRIX_ROW_BOTTOM_Y (first_reusable_row) < yb | 9955 | && MATRIX_ROW_BOTTOM_Y (first_reusable_row) < yb |
| 9954 | && (MATRIX_ROW_START_CHARPOS (first_reusable_row) | 9956 | && (MATRIX_ROW_START_CHARPOS (first_reusable_row) |
| @@ -9980,10 +9982,12 @@ try_window_reusing_current_matrix (w) | |||
| 9980 | /* Start displaying at the start of first_row_to_display. */ | 9982 | /* Start displaying at the start of first_row_to_display. */ |
| 9981 | xassert (first_row_to_display->y < yb); | 9983 | xassert (first_row_to_display->y < yb); |
| 9982 | init_to_row_start (&it, w, first_row_to_display); | 9984 | init_to_row_start (&it, w, first_row_to_display); |
| 9983 | nrows_scrolled = MATRIX_ROW_VPOS (first_reusable_row, w->current_matrix); | 9985 | nrows_scrolled = (MATRIX_ROW_VPOS (first_reusable_row, w->current_matrix) |
| 9986 | - start_vpos); | ||
| 9984 | it.vpos = (MATRIX_ROW_VPOS (first_row_to_display, w->current_matrix) | 9987 | it.vpos = (MATRIX_ROW_VPOS (first_row_to_display, w->current_matrix) |
| 9985 | - nrows_scrolled); | 9988 | - nrows_scrolled); |
| 9986 | it.current_y = first_row_to_display->y - first_reusable_row->y; | 9989 | it.current_y = (first_row_to_display->y - first_reusable_row->y |
| 9990 | + WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w)); | ||
| 9987 | 9991 | ||
| 9988 | /* Display lines beginning with first_row_to_display in the | 9992 | /* Display lines beginning with first_row_to_display in the |
| 9989 | desired matrix. Set last_text_row to the last row displayed | 9993 | desired matrix. Set last_text_row to the last row displayed |
| @@ -10031,10 +10035,9 @@ try_window_reusing_current_matrix (w) | |||
| 10031 | 10035 | ||
| 10032 | /* Adjust Y positions of reused rows. */ | 10036 | /* Adjust Y positions of reused rows. */ |
| 10033 | bottom_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); | 10037 | bottom_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); |
| 10034 | row = first_reusable_row; | ||
| 10035 | min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | 10038 | min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); |
| 10036 | max_y = it.last_visible_y; | 10039 | max_y = it.last_visible_y; |
| 10037 | while (row < first_row_to_display) | 10040 | for (row = first_reusable_row; row < first_row_to_display; ++row) |
| 10038 | { | 10041 | { |
| 10039 | row->y -= dy; | 10042 | row->y -= dy; |
| 10040 | if (row->y < min_y) | 10043 | if (row->y < min_y) |
| @@ -10044,7 +10047,6 @@ try_window_reusing_current_matrix (w) | |||
| 10044 | = row->height - (row->y + row->height - max_y); | 10047 | = row->height - (row->y + row->height - max_y); |
| 10045 | else | 10048 | else |
| 10046 | row->visible_height = row->height; | 10049 | row->visible_height = row->height; |
| 10047 | ++row; | ||
| 10048 | } | 10050 | } |
| 10049 | 10051 | ||
| 10050 | /* Disable rows not reused. */ | 10052 | /* Disable rows not reused. */ |