changeset 12997:938dc2491820

(adjust_markers_for_insert): New function. (insert_from_buffer_1, insert_from_string_1, insert_1): Call it.
author Richard M. Stallman <rms@gnu.org>
date Sun, 03 Sep 1995 18:51:47 +0000
parents 59cb17f969d2
children 404ae27d5148
files src/insdel.c
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/insdel.c	Sun Sep 03 17:34:56 1995 +0000
+++ b/src/insdel.c	Sun Sep 03 18:51:47 1995 +0000
@@ -246,6 +246,26 @@
     }
 }
 
+/* Adjust markers whose insertion-type is t
+   for an insertion of AMOUNT characters at POS.  */
+
+static void
+adjust_markers_for_insert (pos, amount)
+     register int pos, amount;
+{
+  Lisp_Object marker;
+
+  marker = BUF_MARKERS (current_buffer);
+
+  while (!NILP (marker))
+    {
+      register struct Lisp_Marker *m = XMARKER (marker);
+      if (m->insertion_type && m->bufpos == pos)
+	m->bufpos += amount;
+      marker = m->chain;
+    }
+}
+
 /* Add the specified amount to point.  This is used only when the value
    of point changes due to an insert or delete; it does not represent
    a conceptual change in point as a marker.  In particular, point is
@@ -377,6 +397,7 @@
   ZV += length;
   Z += length;
   adjust_overlays_for_insert (PT, length);
+  adjust_markers_for_insert (PT, length);
   adjust_point (length);
 
 #ifdef USE_TEXT_PROPERTIES
@@ -444,6 +465,7 @@
   ZV += length;
   Z += length;
   adjust_overlays_for_insert (PT, length);
+  adjust_markers_for_insert (PT, length);
 
   /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */
   graft_intervals_into_buffer (XSTRING (string)->intervals, PT, length,
@@ -519,6 +541,7 @@
   ZV += length;
   Z += length;
   adjust_overlays_for_insert (PT, length);
+  adjust_markers_for_insert (PT, length);
   adjust_point (length);
 
   /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */