changeset 39333:7af35736264f

(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.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 18 Sep 2001 12:20:53 +0000
parents 4f1342b70a04
children f8ce69d86eea
files src/buffer.c
diffstat 1 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/buffer.c	Tue Sep 18 11:31:02 2001 +0000
+++ b/src/buffer.c	Tue Sep 18 12:20:53 2001 +0000
@@ -180,6 +180,7 @@
 static void alloc_buffer_text P_ ((struct buffer *, size_t));
 static void free_buffer_text P_ ((struct buffer *b));
 static Lisp_Object copy_overlays P_ ((struct buffer *, Lisp_Object));
+static void modify_overlay P_ ((struct buffer *, int, int));
 
 
 /* For debugging; temporary.  See set_buffer_internal.  */
@@ -3402,13 +3403,11 @@
      struct buffer *buf;
      int start, end;
 {
-  if (start == end)
-    return;
-
   if (start > end)
     {
       int temp = start;
-      start = end; end = temp;
+      start = end;
+      end = temp;
     }
 
   BUF_COMPUTE_UNCHANGED (buf, start, end);
@@ -3547,19 +3546,25 @@
     return Qnil;
 
   b = XBUFFER (buffer);
-
   specbind (Qinhibit_quit, Qt);
-
+  
   b->overlays_before = Fdelq (overlay, b->overlays_before);
-  b->overlays_after  = Fdelq (overlay, b->overlays_after);
-
+  b->overlays_after = Fdelq (overlay, b->overlays_after);
   modify_overlay (b,
 		  marker_position (OVERLAY_START (overlay)),
 		  marker_position (OVERLAY_END   (overlay)));
-
   Fset_marker (OVERLAY_START (overlay), Qnil, Qnil);
   Fset_marker (OVERLAY_END   (overlay), Qnil, Qnil);
 
+  /* WHen deleting on overlay with before or after strings, turn off
+     display optimizations for the affected buffer, on the basis that
+     these strings may contain newlines.  This is easier to do than to
+     check for that situation during redisplay.  */
+  if (!windows_or_buffers_changed
+      && (!NILP (Foverlay_get (overlay, Qbefore_string))
+	  || !NILP (Foverlay_get (overlay, Qafter_string))))
+    b->prevent_redisplay_optimizations_p = 1;
+
   return unbind_to (count, Qnil);
 }
 
@@ -3833,8 +3838,8 @@
     {
       if (changed)
 	modify_overlay (XBUFFER (buffer),
-			  marker_position (OVERLAY_START (overlay)),
-			  marker_position (OVERLAY_END   (overlay)));
+			marker_position (OVERLAY_START (overlay)),
+			marker_position (OVERLAY_END   (overlay)));
       if (EQ (prop, Qevaporate) && ! NILP (value)
 	  && (OVERLAY_POSITION (OVERLAY_START (overlay))
 	      == OVERLAY_POSITION (OVERLAY_END (overlay))))