# HG changeset patch # User Richard M. Stallman # Date 861007823 0 # Node ID 8f167ece7e391ec60c82f9956e5c478334f2d3a0 # Parent f2db4e8bb6eddd9a8e4609220e4622b371a98dea (adjust_markers): Don't be confused by the gap when computing the arg to record_marker_adjustment. diff -r f2db4e8bb6ed -r 8f167ece7e39 src/insdel.c --- a/src/insdel.c Mon Apr 14 07:33:28 1997 +0000 +++ b/src/insdel.c Mon Apr 14 08:50:23 1997 +0000 @@ -274,8 +274,24 @@ 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)