comparison src/xdisp.c @ 32539:dd4c7d5e1599

(find_last_unchanged_at_beg_row): Renamed from get_last_unchanged_at_beg_row. (find_first_unchanged_at_end_row): Renamed from get_first_unchanged_at_end_row. (find_first_unchanged_at_end_row): Convert assertions to unconditional tests which abort. When looking for a row in unchanged text, don't go further back than first_text_row.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 16 Oct 2000 15:39:59 +0000
parents 61d4de9a4e35
children 2bd19f54cd7a
comparison
equal deleted inserted replaced
32538:69087927a683 32539:dd4c7d5e1599
10167 10167
10168 /************************************************************************ 10168 /************************************************************************
10169 Window redisplay reusing current matrix when buffer has changed 10169 Window redisplay reusing current matrix when buffer has changed
10170 ************************************************************************/ 10170 ************************************************************************/
10171 10171
10172 static struct glyph_row *get_last_unchanged_at_beg_row P_ ((struct window *)); 10172 static struct glyph_row *find_last_unchanged_at_beg_row P_ ((struct window *));
10173 static struct glyph_row *get_first_unchanged_at_end_row P_ ((struct window *, 10173 static struct glyph_row *find_first_unchanged_at_end_row P_ ((struct window *,
10174 int *, int *)); 10174 int *, int *));
10175 static struct glyph_row * 10175 static struct glyph_row *
10176 find_last_row_displaying_text P_ ((struct glyph_matrix *, struct it *, 10176 find_last_row_displaying_text P_ ((struct glyph_matrix *, struct it *,
10177 struct glyph_row *)); 10177 struct glyph_row *));
10178 10178
10218 current_buffer. Characters at positions < BEG + beg_unchanged are 10218 current_buffer. Characters at positions < BEG + beg_unchanged are
10219 at the same buffer positions as they were when the current matrix 10219 at the same buffer positions as they were when the current matrix
10220 was built. */ 10220 was built. */
10221 10221
10222 static struct glyph_row * 10222 static struct glyph_row *
10223 get_last_unchanged_at_beg_row (w) 10223 find_last_unchanged_at_beg_row (w)
10224 struct window *w; 10224 struct window *w;
10225 { 10225 {
10226 int first_changed_pos = BEG + BEG_UNCHANGED; 10226 int first_changed_pos = BEG + BEG_UNCHANGED;
10227 struct glyph_row *row; 10227 struct glyph_row *row;
10228 struct glyph_row *row_found = NULL; 10228 struct glyph_row *row_found = NULL;
10264 current_buffer must be adjusted. Return in *DELTA_BYTES the 10264 current_buffer must be adjusted. Return in *DELTA_BYTES the
10265 corresponding number of bytes. Value is null if no such row 10265 corresponding number of bytes. Value is null if no such row
10266 exists, i.e. all rows are affected by changes. */ 10266 exists, i.e. all rows are affected by changes. */
10267 10267
10268 static struct glyph_row * 10268 static struct glyph_row *
10269 get_first_unchanged_at_end_row (w, delta, delta_bytes) 10269 find_first_unchanged_at_end_row (w, delta, delta_bytes)
10270 struct window *w; 10270 struct window *w;
10271 int *delta, *delta_bytes; 10271 int *delta, *delta_bytes;
10272 { 10272 {
10273 struct glyph_row *row; 10273 struct glyph_row *row;
10274 struct glyph_row *row_found = NULL; 10274 struct glyph_row *row_found = NULL;
10275 10275
10276 *delta = *delta_bytes = 0; 10276 *delta = *delta_bytes = 0;
10277 10277
10278 /* A value of window_end_pos >= end_unchanged means that the window 10278 /* Display must not have been paused, otherwise the current matrix
10279 is not up to date. */
10280 if (NILP (w->window_end_valid))
10281 abort ();
10282
10283 /* A value of window_end_pos >= END_UNCHANGED means that the window
10279 end is in the range of changed text. If so, there is no 10284 end is in the range of changed text. If so, there is no
10280 unchanged row at the end of W's current matrix. */ 10285 unchanged row at the end of W's current matrix. */
10281 xassert (!NILP (w->window_end_valid));
10282 if (XFASTINT (w->window_end_pos) >= END_UNCHANGED) 10286 if (XFASTINT (w->window_end_pos) >= END_UNCHANGED)
10283 return NULL; 10287 return NULL;
10284 10288
10285 /* Set row to the last row in W's current matrix displaying text. */ 10289 /* Set row to the last row in W's current matrix displaying text. */
10286 row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); 10290 row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
10311 last_unchanged_pos = Z - END_UNCHANGED + BEG; 10315 last_unchanged_pos = Z - END_UNCHANGED + BEG;
10312 last_unchanged_pos_old = last_unchanged_pos - *delta; 10316 last_unchanged_pos_old = last_unchanged_pos - *delta;
10313 10317
10314 /* Search backward from ROW for a row displaying a line that 10318 /* Search backward from ROW for a row displaying a line that
10315 starts at a minimum position >= last_unchanged_pos_old. */ 10319 starts at a minimum position >= last_unchanged_pos_old. */
10316 while (row >= first_text_row) 10320 for (; row > first_text_row; --row)
10317 { 10321 {
10318 xassert (row->enabled_p); 10322 if (!row->enabled_p || !MATRIX_ROW_DISPLAYS_TEXT_P (row))
10319 xassert (MATRIX_ROW_DISPLAYS_TEXT_P (row)); 10323 abort ();
10320 10324
10321 if (MATRIX_ROW_START_CHARPOS (row) >= last_unchanged_pos_old) 10325 if (MATRIX_ROW_START_CHARPOS (row) >= last_unchanged_pos_old)
10322 row_found = row; 10326 row_found = row;
10323 --row; 10327 }
10324 } 10328 }
10325 } 10329
10326 10330 if (row_found && !MATRIX_ROW_DISPLAYS_TEXT_P (row_found))
10327 xassert (!row_found || MATRIX_ROW_DISPLAYS_TEXT_P (row_found)); 10331 abort ();
10332
10328 return row_found; 10333 return row_found;
10329 } 10334 }
10330 10335
10331 10336
10332 /* Make sure that glyph rows in the current matrix of window W 10337 /* Make sure that glyph rows in the current matrix of window W
10562 lines. Some of the lines at the top of the window might be 10567 lines. Some of the lines at the top of the window might be
10563 reusable because they are not displaying changed text. Find the 10568 reusable because they are not displaying changed text. Find the
10564 last row in W's current matrix not affected by changes at the 10569 last row in W's current matrix not affected by changes at the
10565 start of current_buffer. Value is null if changes start in the 10570 start of current_buffer. Value is null if changes start in the
10566 first line of window. */ 10571 first line of window. */
10567 last_unchanged_at_beg_row = get_last_unchanged_at_beg_row (w); 10572 last_unchanged_at_beg_row = find_last_unchanged_at_beg_row (w);
10568 if (last_unchanged_at_beg_row) 10573 if (last_unchanged_at_beg_row)
10569 { 10574 {
10570 init_to_row_end (&it, w, last_unchanged_at_beg_row); 10575 init_to_row_end (&it, w, last_unchanged_at_beg_row);
10571 start_pos = it.current.pos; 10576 start_pos = it.current.pos;
10572 10577
10593 which case we must redisplay to the end of the window. delta 10598 which case we must redisplay to the end of the window. delta
10594 will be set to the value by which buffer positions beginning with 10599 will be set to the value by which buffer positions beginning with
10595 first_unchanged_at_end_row have to be adjusted due to text 10600 first_unchanged_at_end_row have to be adjusted due to text
10596 changes. */ 10601 changes. */
10597 first_unchanged_at_end_row 10602 first_unchanged_at_end_row
10598 = get_first_unchanged_at_end_row (w, &delta, &delta_bytes); 10603 = find_first_unchanged_at_end_row (w, &delta, &delta_bytes);
10599 IF_DEBUG (debug_delta = delta); 10604 IF_DEBUG (debug_delta = delta);
10600 IF_DEBUG (debug_delta_bytes = delta_bytes); 10605 IF_DEBUG (debug_delta_bytes = delta_bytes);
10601 10606
10602 /* Set stop_pos to the buffer position up to which we will have to 10607 /* Set stop_pos to the buffer position up to which we will have to
10603 display new lines. If first_unchanged_at_end_row != NULL, this 10608 display new lines. If first_unchanged_at_end_row != NULL, this