diff options
| author | Richard M. Stallman | 1996-09-15 02:03:32 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-09-15 02:03:32 +0000 |
| commit | 8850a57342aab55d8330085ec3caf03f5bcb1711 (patch) | |
| tree | 560ebe6dedb5fc3fe66659a140813d6aa4db5539 /src | |
| parent | 598ba4c7d53a8afaab75b3da9ed05381fcf89753 (diff) | |
| download | emacs-8850a57342aab55d8330085ec3caf03f5bcb1711.tar.gz emacs-8850a57342aab55d8330085ec3caf03f5bcb1711.zip | |
(redisplay_internal, mark_window_display_accurate)
(redisplay_window): Test and update last_overlay_modified field
along with last_modified.
(overlay_unchanged_modified): New variable.
(redisplay_internal): Set overlay_unchanged_modified.
(redisplay_region): Renamed and moved to buffer.c.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 96 |
1 files changed, 21 insertions, 75 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 532d548b2dd..ab25dc67ebd 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -211,10 +211,14 @@ int beg_unchanged; | |||
| 211 | int end_unchanged; | 211 | int end_unchanged; |
| 212 | 212 | ||
| 213 | /* MODIFF as of last redisplay that finished; | 213 | /* MODIFF as of last redisplay that finished; |
| 214 | if it matches MODIFF, beg_unchanged and end_unchanged | 214 | if it matches MODIFF, and overlay_unchanged_modified |
| 215 | matches OVERLAY_MODIFF, that means beg_unchanged and end_unchanged | ||
| 215 | contain no useful information */ | 216 | contain no useful information */ |
| 216 | int unchanged_modified; | 217 | int unchanged_modified; |
| 217 | 218 | ||
| 219 | /* OVERLAY_MODIFF as of last redisplay that finished. */ | ||
| 220 | int overlay_unchanged_modified; | ||
| 221 | |||
| 218 | /* Nonzero if window sizes or contents have changed | 222 | /* Nonzero if window sizes or contents have changed |
| 219 | since last redisplay that finished */ | 223 | since last redisplay that finished */ |
| 220 | int windows_or_buffers_changed; | 224 | int windows_or_buffers_changed; |
| @@ -897,7 +901,8 @@ redisplay_internal (preserve_echo_area) | |||
| 897 | /* This alternative quickly identifies a common case | 901 | /* This alternative quickly identifies a common case |
| 898 | where no change is needed. */ | 902 | where no change is needed. */ |
| 899 | && !(PT == XFASTINT (w->last_point) | 903 | && !(PT == XFASTINT (w->last_point) |
| 900 | && XFASTINT (w->last_modified) >= MODIFF) | 904 | && XFASTINT (w->last_modified) >= MODIFF |
| 905 | && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF) | ||
| 901 | && XFASTINT (w->column_number_displayed) != current_column ()) | 906 | && XFASTINT (w->column_number_displayed) != current_column ()) |
| 902 | w->update_mode_line = Qt; | 907 | w->update_mode_line = Qt; |
| 903 | 908 | ||
| @@ -944,7 +949,8 @@ redisplay_internal (preserve_echo_area) | |||
| 944 | && PT <= Z - tlendpos | 949 | && PT <= Z - tlendpos |
| 945 | /* All text outside that line, including its final newline, | 950 | /* All text outside that line, including its final newline, |
| 946 | must be unchanged */ | 951 | must be unchanged */ |
| 947 | && (XFASTINT (w->last_modified) >= MODIFF | 952 | && ((XFASTINT (w->last_modified) >= MODIFF |
| 953 | && (XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF)) | ||
| 948 | || (beg_unchanged >= tlbufpos - 1 | 954 | || (beg_unchanged >= tlbufpos - 1 |
| 949 | && GPT >= tlbufpos | 955 | && GPT >= tlbufpos |
| 950 | /* If selective display, can't optimize | 956 | /* If selective display, can't optimize |
| @@ -963,6 +969,7 @@ redisplay_internal (preserve_echo_area) | |||
| 963 | /* Former continuation line has disappeared by becoming empty */ | 969 | /* Former continuation line has disappeared by becoming empty */ |
| 964 | goto cancel; | 970 | goto cancel; |
| 965 | else if (XFASTINT (w->last_modified) < MODIFF | 971 | else if (XFASTINT (w->last_modified) < MODIFF |
| 972 | || XFASTINT (w->last_overlay_modified) < OVERLAY_MODIFF | ||
| 966 | || MINI_WINDOW_P (w)) | 973 | || MINI_WINDOW_P (w)) |
| 967 | { | 974 | { |
| 968 | cursor_vpos = -1; | 975 | cursor_vpos = -1; |
| @@ -1188,6 +1195,7 @@ update: | |||
| 1188 | 1195 | ||
| 1189 | blank_end_of_window = 0; | 1196 | blank_end_of_window = 0; |
| 1190 | unchanged_modified = BUF_MODIFF (b); | 1197 | unchanged_modified = BUF_MODIFF (b); |
| 1198 | overlay_unchanged_modified = BUF_OVERLAY_MODIFF (b); | ||
| 1191 | beg_unchanged = BUF_GPT (b) - BUF_BEG (b); | 1199 | beg_unchanged = BUF_GPT (b) - BUF_BEG (b); |
| 1192 | end_unchanged = BUF_Z (b) - BUF_GPT (b); | 1200 | end_unchanged = BUF_Z (b) - BUF_GPT (b); |
| 1193 | 1201 | ||
| @@ -1202,6 +1210,7 @@ update: | |||
| 1202 | b->clip_changed = 0; | 1210 | b->clip_changed = 0; |
| 1203 | w->update_mode_line = Qnil; | 1211 | w->update_mode_line = Qnil; |
| 1204 | XSETFASTINT (w->last_modified, BUF_MODIFF (b)); | 1212 | XSETFASTINT (w->last_modified, BUF_MODIFF (b)); |
| 1213 | XSETFASTINT (w->last_overlay_modified, BUF_OVERLAY_MODIFF (b)); | ||
| 1205 | w->last_had_star | 1214 | w->last_had_star |
| 1206 | = (BUF_MODIFF (XBUFFER (w->buffer)) > BUF_SAVE_MODIFF (XBUFFER (w->buffer)) | 1215 | = (BUF_MODIFF (XBUFFER (w->buffer)) > BUF_SAVE_MODIFF (XBUFFER (w->buffer)) |
| 1207 | ? Qt : Qnil); | 1216 | ? Qt : Qnil); |
| @@ -1273,6 +1282,8 @@ mark_window_display_accurate (window, flag) | |||
| 1273 | { | 1282 | { |
| 1274 | XSETFASTINT (w->last_modified, | 1283 | XSETFASTINT (w->last_modified, |
| 1275 | !flag ? 0 : BUF_MODIFF (XBUFFER (w->buffer))); | 1284 | !flag ? 0 : BUF_MODIFF (XBUFFER (w->buffer))); |
| 1285 | XSETFASTINT (w->last_overlay_modified, | ||
| 1286 | !flag ? 0 : BUF_OVERLAY_MODIFF (XBUFFER (w->buffer))); | ||
| 1276 | w->last_had_star | 1287 | w->last_had_star |
| 1277 | = (BUF_MODIFF (XBUFFER (w->buffer)) > BUF_SAVE_MODIFF (XBUFFER (w->buffer)) | 1288 | = (BUF_MODIFF (XBUFFER (w->buffer)) > BUF_SAVE_MODIFF (XBUFFER (w->buffer)) |
| 1278 | ? Qt : Qnil); | 1289 | ? Qt : Qnil); |
| @@ -1488,7 +1499,8 @@ redisplay_window (window, just_this_one, preserve_echo_area) | |||
| 1488 | /* This alternative quickly identifies a common case | 1499 | /* This alternative quickly identifies a common case |
| 1489 | where no change is needed. */ | 1500 | where no change is needed. */ |
| 1490 | && !(PT == XFASTINT (w->last_point) | 1501 | && !(PT == XFASTINT (w->last_point) |
| 1491 | && XFASTINT (w->last_modified) >= MODIFF) | 1502 | && XFASTINT (w->last_modified) >= MODIFF |
| 1503 | && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF) | ||
| 1492 | && XFASTINT (w->column_number_displayed) != current_column ()) | 1504 | && XFASTINT (w->column_number_displayed) != current_column ()) |
| 1493 | update_mode_line = 1; | 1505 | update_mode_line = 1; |
| 1494 | 1506 | ||
| @@ -1584,6 +1596,7 @@ redisplay_window (window, just_this_one, preserve_echo_area) | |||
| 1584 | } | 1596 | } |
| 1585 | } | 1597 | } |
| 1586 | XSETFASTINT (w->last_modified, 0); | 1598 | XSETFASTINT (w->last_modified, 0); |
| 1599 | XSETFASTINT (w->last_overlay_modified, 0); | ||
| 1587 | if (startp < BEGV) startp = BEGV; | 1600 | if (startp < BEGV) startp = BEGV; |
| 1588 | if (startp > ZV) startp = ZV; | 1601 | if (startp > ZV) startp = ZV; |
| 1589 | try_window (window, startp); | 1602 | try_window (window, startp); |
| @@ -1633,6 +1646,7 @@ redisplay_window (window, just_this_one, preserve_echo_area) | |||
| 1633 | in redisplay handles the same cases. */ | 1646 | in redisplay handles the same cases. */ |
| 1634 | 1647 | ||
| 1635 | if (XFASTINT (w->last_modified) >= MODIFF | 1648 | if (XFASTINT (w->last_modified) >= MODIFF |
| 1649 | && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF | ||
| 1636 | && PT >= startp && !current_buffer->clip_changed | 1650 | && PT >= startp && !current_buffer->clip_changed |
| 1637 | && (just_this_one || XFASTINT (w->width) == FRAME_WIDTH (f)) | 1651 | && (just_this_one || XFASTINT (w->width) == FRAME_WIDTH (f)) |
| 1638 | /* If force-mode-line-update was called, really redisplay; | 1652 | /* If force-mode-line-update was called, really redisplay; |
| @@ -1720,7 +1734,8 @@ redisplay_window (window, just_this_one, preserve_echo_area) | |||
| 1720 | || preserve_echo_area | 1734 | || preserve_echo_area |
| 1721 | #endif | 1735 | #endif |
| 1722 | || startp == BEGV | 1736 | || startp == BEGV |
| 1723 | || (XFASTINT (w->last_modified) >= MODIFF))) | 1737 | || (XFASTINT (w->last_modified) >= MODIFF |
| 1738 | && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF))) | ||
| 1724 | { | 1739 | { |
| 1725 | /* Try to redisplay starting at same place as before */ | 1740 | /* Try to redisplay starting at same place as before */ |
| 1726 | /* If point has not moved off frame, accept the results */ | 1741 | /* If point has not moved off frame, accept the results */ |
| @@ -1738,6 +1753,7 @@ redisplay_window (window, just_this_one, preserve_echo_area) | |||
| 1738 | } | 1753 | } |
| 1739 | 1754 | ||
| 1740 | XSETFASTINT (w->last_modified, 0); | 1755 | XSETFASTINT (w->last_modified, 0); |
| 1756 | XSETFASTINT (w->last_overlay_modified, 0); | ||
| 1741 | /* Redisplay the mode line. Select the buffer properly for that. */ | 1757 | /* Redisplay the mode line. Select the buffer properly for that. */ |
| 1742 | if (!update_mode_line) | 1758 | if (!update_mode_line) |
| 1743 | { | 1759 | { |
| @@ -2356,76 +2372,6 @@ try_window_id (window) | |||
| 2356 | return 1; | 2372 | return 1; |
| 2357 | } | 2373 | } |
| 2358 | 2374 | ||
| 2359 | /* Mark a section of BUF as modified, but only for the sake of redisplay. | ||
| 2360 | This is useful for recording changes to overlays. | ||
| 2361 | |||
| 2362 | We increment the buffer's modification timestamp and set the | ||
| 2363 | redisplay caches (windows_or_buffers_changed, beg_unchanged, etc) | ||
| 2364 | as if the region of text between START and END had been modified; | ||
| 2365 | the redisplay code will check this against the windows' timestamps, | ||
| 2366 | and redraw the appropriate area of the buffer. | ||
| 2367 | |||
| 2368 | However, if the buffer is unmodified, we bump the last-save | ||
| 2369 | timestamp as well, so that incrementing the timestamp doesn't fool | ||
| 2370 | Emacs into thinking that the buffer's text has been modified. | ||
| 2371 | |||
| 2372 | Tweaking the timestamps shouldn't hurt the first-modification | ||
| 2373 | timestamps recorded in the undo records; those values aren't | ||
| 2374 | written until just before a real text modification is made, so they | ||
| 2375 | will never catch the timestamp value just before this function gets | ||
| 2376 | called. */ | ||
| 2377 | |||
| 2378 | void | ||
| 2379 | redisplay_region (buf, start, end) | ||
| 2380 | struct buffer *buf; | ||
| 2381 | int start, end; | ||
| 2382 | { | ||
| 2383 | if (start == end) | ||
| 2384 | return; | ||
| 2385 | |||
| 2386 | if (start > end) | ||
| 2387 | { | ||
| 2388 | int temp = start; | ||
| 2389 | start = end; end = temp; | ||
| 2390 | } | ||
| 2391 | |||
| 2392 | /* If this is a buffer not in the selected window, | ||
| 2393 | we must do other windows. */ | ||
| 2394 | if (buf != XBUFFER (XWINDOW (selected_window)->buffer)) | ||
| 2395 | windows_or_buffers_changed = 1; | ||
| 2396 | /* If it's not current, we can't use beg_unchanged, end_unchanged for it. */ | ||
| 2397 | else if (buf != current_buffer) | ||
| 2398 | windows_or_buffers_changed = 1; | ||
| 2399 | /* If multiple windows show this buffer, we must do other windows. */ | ||
| 2400 | else if (buffer_shared > 1) | ||
| 2401 | windows_or_buffers_changed = 1; | ||
| 2402 | else | ||
| 2403 | { | ||
| 2404 | if (unchanged_modified == MODIFF) | ||
| 2405 | { | ||
| 2406 | beg_unchanged = start - BEG; | ||
| 2407 | end_unchanged = Z - end; | ||
| 2408 | } | ||
| 2409 | else | ||
| 2410 | { | ||
| 2411 | if (Z - end < end_unchanged) | ||
| 2412 | end_unchanged = Z - end; | ||
| 2413 | if (start - BEG < beg_unchanged) | ||
| 2414 | beg_unchanged = start - BEG; | ||
| 2415 | } | ||
| 2416 | } | ||
| 2417 | |||
| 2418 | /* Increment the buffer's time stamp, but also increment the save | ||
| 2419 | and autosave timestamps, so as not to screw up that timekeeping. */ | ||
| 2420 | if (BUF_MODIFF (buf) == BUF_SAVE_MODIFF (buf)) | ||
| 2421 | BUF_SAVE_MODIFF (buf)++; | ||
| 2422 | if (BUF_MODIFF (buf) == buf->auto_save_modified) | ||
| 2423 | buf->auto_save_modified++; | ||
| 2424 | |||
| 2425 | BUF_MODIFF (buf) ++; | ||
| 2426 | } | ||
| 2427 | |||
| 2428 | |||
| 2429 | /* Copy LEN glyphs starting address FROM to the rope TO. | 2375 | /* Copy LEN glyphs starting address FROM to the rope TO. |
| 2430 | But don't actually copy the parts that would come in before S. | 2376 | But don't actually copy the parts that would come in before S. |
| 2431 | Value is TO, advanced past the copied data. | 2377 | Value is TO, advanced past the copied data. |