changeset 11097:e1b4b0d66bf3

(overlay_touches_p): New function.
author Karl Heuer <kwzh@gnu.org>
date Wed, 22 Mar 1995 21:23:10 +0000
parents cac0367b1794
children 03b481b6cec2
files src/buffer.c
diffstat 1 files changed, 41 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/buffer.c	Wed Mar 22 21:22:31 1995 +0000
+++ b/src/buffer.c	Wed Mar 22 21:23:10 1995 +0000
@@ -1631,6 +1631,47 @@
     *prev_ptr = prev;
   return idx;
 }
+
+/* Fast function to just test if we're at an overlay boundary.  */
+int
+overlay_touches_p (pos)
+     int pos;
+{
+  Lisp_Object tail, overlay;
+
+  for (tail = current_buffer->overlays_before; GC_CONSP (tail);
+       tail = XCONS (tail)->cdr)
+    {
+      int endpos;
+
+      overlay = XCONS (tail)->car;
+      if (!GC_OVERLAYP (overlay))
+	abort ();
+
+      endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
+      if (endpos < pos)
+	break;
+      if (endpos == pos || OVERLAY_POSITION (OVERLAY_START (overlay)) == pos)
+	return 1;
+    }
+
+  for (tail = current_buffer->overlays_after; GC_CONSP (tail);
+       tail = XCONS (tail)->cdr)
+    {
+      int startpos;
+
+      overlay = XCONS (tail)->car;
+      if (!GC_OVERLAYP (overlay))
+	abort ();
+
+      startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
+      if (pos < startpos)
+	break;
+      if (startpos == pos || OVERLAY_POSITION (OVERLAY_END (overlay)) == pos)
+	return 1;
+    }
+  return 0;
+}
 
 struct sortvec
 {