changeset 16193:6ff2ef91c618

(modify_overlay): Renamed from redisplay_region moved here from xdisp.c, and made static. Callers changed. Update OVERLAY_MODIFF instead of MODIFF.
author Richard M. Stallman <rms@gnu.org>
date Sun, 15 Sep 1996 01:57:03 +0000
parents b67b2e8eacb3
children aef021e2c167
files src/buffer.c
diffstat 1 files changed, 55 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/buffer.c	Sun Sep 15 01:49:52 1996 +0000
+++ b/src/buffer.c	Sun Sep 15 01:57:03 1996 +0000
@@ -2583,7 +2583,54 @@
 
   return overlay;
 }
-
+
+/* Mark a section of BUF as needing redisplay because of overlays changes.  */
+
+static void
+modify_overlay (buf, start, end)
+     struct buffer *buf;
+     int start, end;
+{
+  if (start == end)
+    return;
+
+  if (start > end)
+    {
+      int temp = start;
+      start = end; end = temp;
+    }
+
+  /* If this is a buffer not in the selected window,
+     we must do other windows.  */
+  if (buf != XBUFFER (XWINDOW (selected_window)->buffer))
+    windows_or_buffers_changed = 1;
+  /* If it's not current, we can't use beg_unchanged, end_unchanged for it.  */
+  else if (buf != current_buffer)
+    windows_or_buffers_changed = 1;
+  /* If multiple windows show this buffer, we must do other windows.  */
+  else if (buffer_shared > 1)
+    windows_or_buffers_changed = 1;
+  else
+    {
+      if (unchanged_modified == MODIFF
+	  && overlay_unchanged_modified == OVERLAY_MODIFF)
+	{
+	  beg_unchanged = start - BEG;
+	  end_unchanged = Z - end;
+	}
+      else
+	{
+	  if (Z - end < end_unchanged)
+	    end_unchanged = Z - end;
+	  if (start - BEG < beg_unchanged)
+	    beg_unchanged = start - BEG;
+	}
+    }
+
+  ++OVERLAY_MODIFF;
+}
+
+
 DEFUN ("move-overlay", Fmove_overlay, Smove_overlay, 3, 4, 0,
   "Set the endpoints of OVERLAY to BEG and END in BUFFER.\n\
 If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now.\n\
@@ -2642,11 +2689,11 @@
 	  o_beg = OVERLAY_POSITION (o_beg);
 	  o_end = OVERLAY_POSITION (o_end);
 
-	  redisplay_region (ob, XINT (o_beg), XINT (o_end));
+	  modify_overlay (ob, XINT (o_beg), XINT (o_end));
 	}
 
       /* Redisplay where the overlay is going to be.  */
-      redisplay_region (b, XINT (beg), XINT (end));
+      modify_overlay (b, XINT (beg), XINT (end));
     }
   else
     /* Redisplay the area the overlay has just left, or just enclosed.  */
@@ -2661,14 +2708,14 @@
       o_end = OVERLAY_POSITION (o_end);
 
       if (XINT (o_beg) == XINT (beg))
-	redisplay_region (b, XINT (o_end), XINT (end));
+	modify_overlay (b, XINT (o_end), XINT (end));
       else if (XINT (o_end) == XINT (end))
-	redisplay_region (b, XINT (o_beg), XINT (beg));
+	modify_overlay (b, XINT (o_beg), XINT (beg));
       else
 	{
 	  if (XINT (beg) < XINT (o_beg)) o_beg = beg;
 	  if (XINT (end) > XINT (o_end)) o_end = end;
-	  redisplay_region (b, XINT (o_beg), XINT (o_end));
+	  modify_overlay (b, XINT (o_beg), XINT (o_end));
 	}
     }
 
@@ -2716,7 +2763,7 @@
   b->overlays_before = Fdelq (overlay, b->overlays_before);
   b->overlays_after  = Fdelq (overlay, b->overlays_after);
 
-  redisplay_region (b,
+  modify_overlay (b,
 		    marker_position (OVERLAY_START (overlay)),
 		    marker_position (OVERLAY_END   (overlay)));
 
@@ -3025,7 +3072,7 @@
   if (! NILP (buffer))
     {
       if (changed)
-	redisplay_region (XBUFFER (buffer),
+	modify_overlay (XBUFFER (buffer),
 			  marker_position (OVERLAY_START (overlay)),
 			  marker_position (OVERLAY_END   (overlay)));
       if (EQ (prop, Qevaporate) && ! NILP (value)