From: Kenichi Handa Date: Wed, 21 Aug 2002 13:07:13 +0000 (+0000) Subject: (insert_from_gap): Make it work even if PT != GTP. X-Git-Tag: emacs-pretest-23.0.90~8295^2~1864^2~396 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=372de96a628179274bc8c673591d7aca28615c79;p=emacs.git (insert_from_gap): Make it work even if PT != GTP. --- diff --git a/src/insdel.c b/src/insdel.c index 1f3cff6e8fd..f782a88320d 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1038,19 +1038,16 @@ insert_1_both (string, nchars, nbytes, inherit, prepare, before_markers) } /* Insert a sequence of NCHARS chars which occupy NBYTES bytes - starting at GPT_ADDR. This funciton assumes PT == GPT. */ + starting at GPT_ADDR. */ void insert_from_gap (nchars, nbytes) register int nchars, nbytes; { - if (PT != GPT) - abort (); - if (NILP (current_buffer->enable_multibyte_characters)) nchars = nbytes; - record_insert (PT, nchars); + record_insert (GPT, nchars); MODIFF++; GAP_SIZE -= nbytes; @@ -1065,15 +1062,16 @@ insert_from_gap (nchars, nbytes) if (GPT_BYTE < GPT) abort (); - adjust_overlays_for_insert (PT, nchars); - adjust_markers_for_insert (PT, PT_BYTE, - PT + nchars, PT_BYTE + nbytes, + adjust_overlays_for_insert (GPT, nchars); + adjust_markers_for_insert (GPT, GPT_BYTE, + GPT + nchars, GPT_BYTE + nbytes, 0); if (BUF_INTERVALS (current_buffer) != 0) offset_intervals (current_buffer, PT, nchars); - adjust_point (nchars, nbytes); + if (GPT - nchars < PT) + adjust_point (nchars, nbytes); CHECK_MARKERS (); }