]> code.delx.au - gnu-emacs/blobdiff - src/insdel.c
Delete the code that was trying to define BSD "right"
[gnu-emacs] / 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)