]> git.eshelyaron.com Git - emacs.git/commitdiff
(adjust_markers): Don't be confused by the gap
authorRichard M. Stallman <rms@gnu.org>
Mon, 14 Apr 1997 08:50:23 +0000 (08:50 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 14 Apr 1997 08:50:23 +0000 (08:50 +0000)
when computing the arg to record_marker_adjustment.

src/insdel.c

index aa431f588371ee92034eb8fc73cf39491569c738..12b7eedb58b5f28dbd891a5c4122540275f97237 100644 (file)
@@ -274,8 +274,24 @@ adjust_markers (from, to, amount)
             but then this range contains no markers.  */
          if (mpos > from + amount && mpos <= from)
            {
-             record_marker_adjustment (marker, from + amount - mpos);
-             mpos = from + amount;
+             int before = mpos;
+             int after = from + amount;
+
+             mpos = after;
+
+             /* Compute the before and after positions
+                as buffer positions.  */
+             if (before > GPT + GAP_SIZE)
+               before -= GAP_SIZE;
+             else if (before > GPT)
+               before = GPT;
+
+             if (after > GPT + GAP_SIZE)
+               after -= GAP_SIZE;
+             else if (after > GPT)
+               after = GPT;
+
+             record_marker_adjustment (marker, after - before);
            }
        }
       if (mpos > from && mpos <= to)