diff options
| author | Gerd Moellmann | 2001-09-18 12:20:53 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-09-18 12:20:53 +0000 |
| commit | 26f545d7f8efb31dcfb49fd643f448f34343d7bd (patch) | |
| tree | f5448a3917f15eb71eb3889eae9805f2d7da4bb1 /src | |
| parent | 1270031d86a63187c6112c144b5f1a83cf15f510 (diff) | |
| download | emacs-26f545d7f8efb31dcfb49fd643f448f34343d7bd.tar.gz emacs-26f545d7f8efb31dcfb49fd643f448f34343d7bd.zip | |
(modify_overlay): Don't do nothing if START == END;
This can still be a modification, for example when an overlay has
a before-string or after-string.
(Fdelete_overlay): Prevent redisplay optimizations when deleting
an overlay with before-string or after-string.
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/buffer.c b/src/buffer.c index eed4272cc95..1b559faaee1 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -180,6 +180,7 @@ Lisp_Object Qinsert_behind_hooks; | |||
| 180 | static void alloc_buffer_text P_ ((struct buffer *, size_t)); | 180 | static void alloc_buffer_text P_ ((struct buffer *, size_t)); |
| 181 | static void free_buffer_text P_ ((struct buffer *b)); | 181 | static void free_buffer_text P_ ((struct buffer *b)); |
| 182 | static Lisp_Object copy_overlays P_ ((struct buffer *, Lisp_Object)); | 182 | static Lisp_Object copy_overlays P_ ((struct buffer *, Lisp_Object)); |
| 183 | static void modify_overlay P_ ((struct buffer *, int, int)); | ||
| 183 | 184 | ||
| 184 | 185 | ||
| 185 | /* For debugging; temporary. See set_buffer_internal. */ | 186 | /* For debugging; temporary. See set_buffer_internal. */ |
| @@ -3402,13 +3403,11 @@ modify_overlay (buf, start, end) | |||
| 3402 | struct buffer *buf; | 3403 | struct buffer *buf; |
| 3403 | int start, end; | 3404 | int start, end; |
| 3404 | { | 3405 | { |
| 3405 | if (start == end) | ||
| 3406 | return; | ||
| 3407 | |||
| 3408 | if (start > end) | 3406 | if (start > end) |
| 3409 | { | 3407 | { |
| 3410 | int temp = start; | 3408 | int temp = start; |
| 3411 | start = end; end = temp; | 3409 | start = end; |
| 3410 | end = temp; | ||
| 3412 | } | 3411 | } |
| 3413 | 3412 | ||
| 3414 | BUF_COMPUTE_UNCHANGED (buf, start, end); | 3413 | BUF_COMPUTE_UNCHANGED (buf, start, end); |
| @@ -3547,19 +3546,25 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, | |||
| 3547 | return Qnil; | 3546 | return Qnil; |
| 3548 | 3547 | ||
| 3549 | b = XBUFFER (buffer); | 3548 | b = XBUFFER (buffer); |
| 3550 | |||
| 3551 | specbind (Qinhibit_quit, Qt); | 3549 | specbind (Qinhibit_quit, Qt); |
| 3552 | 3550 | ||
| 3553 | b->overlays_before = Fdelq (overlay, b->overlays_before); | 3551 | b->overlays_before = Fdelq (overlay, b->overlays_before); |
| 3554 | b->overlays_after = Fdelq (overlay, b->overlays_after); | 3552 | b->overlays_after = Fdelq (overlay, b->overlays_after); |
| 3555 | |||
| 3556 | modify_overlay (b, | 3553 | modify_overlay (b, |
| 3557 | marker_position (OVERLAY_START (overlay)), | 3554 | marker_position (OVERLAY_START (overlay)), |
| 3558 | marker_position (OVERLAY_END (overlay))); | 3555 | marker_position (OVERLAY_END (overlay))); |
| 3559 | |||
| 3560 | Fset_marker (OVERLAY_START (overlay), Qnil, Qnil); | 3556 | Fset_marker (OVERLAY_START (overlay), Qnil, Qnil); |
| 3561 | Fset_marker (OVERLAY_END (overlay), Qnil, Qnil); | 3557 | Fset_marker (OVERLAY_END (overlay), Qnil, Qnil); |
| 3562 | 3558 | ||
| 3559 | /* WHen deleting on overlay with before or after strings, turn off | ||
| 3560 | display optimizations for the affected buffer, on the basis that | ||
| 3561 | these strings may contain newlines. This is easier to do than to | ||
| 3562 | check for that situation during redisplay. */ | ||
| 3563 | if (!windows_or_buffers_changed | ||
| 3564 | && (!NILP (Foverlay_get (overlay, Qbefore_string)) | ||
| 3565 | || !NILP (Foverlay_get (overlay, Qafter_string)))) | ||
| 3566 | b->prevent_redisplay_optimizations_p = 1; | ||
| 3567 | |||
| 3563 | return unbind_to (count, Qnil); | 3568 | return unbind_to (count, Qnil); |
| 3564 | } | 3569 | } |
| 3565 | 3570 | ||
| @@ -3833,8 +3838,8 @@ DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0, | |||
| 3833 | { | 3838 | { |
| 3834 | if (changed) | 3839 | if (changed) |
| 3835 | modify_overlay (XBUFFER (buffer), | 3840 | modify_overlay (XBUFFER (buffer), |
| 3836 | marker_position (OVERLAY_START (overlay)), | 3841 | marker_position (OVERLAY_START (overlay)), |
| 3837 | marker_position (OVERLAY_END (overlay))); | 3842 | marker_position (OVERLAY_END (overlay))); |
| 3838 | if (EQ (prop, Qevaporate) && ! NILP (value) | 3843 | if (EQ (prop, Qevaporate) && ! NILP (value) |
| 3839 | && (OVERLAY_POSITION (OVERLAY_START (overlay)) | 3844 | && (OVERLAY_POSITION (OVERLAY_START (overlay)) |
| 3840 | == OVERLAY_POSITION (OVERLAY_END (overlay)))) | 3845 | == OVERLAY_POSITION (OVERLAY_END (overlay)))) |