From: Richard M. Stallman Date: Mon, 14 Apr 1997 08:50:23 +0000 (+0000) Subject: (adjust_markers): Don't be confused by the gap X-Git-Tag: emacs-20.1~2499 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9856e2185f488477d974c4d373b0838bad2737fd;p=emacs.git (adjust_markers): Don't be confused by the gap when computing the arg to record_marker_adjustment. --- diff --git a/src/insdel.c b/src/insdel.c index aa431f58837..12b7eedb58b 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -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)