Mercurial > emacs
changeset 17446:8f167ece7e39
(adjust_markers): Don't be confused by the gap
when computing the arg to record_marker_adjustment.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 14 Apr 1997 08:50:23 +0000 |
parents | f2db4e8bb6ed |
children | dc2cb454b330 |
files | src/insdel.c |
diffstat | 1 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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)