# HG changeset patch # User Kenichi Handa # Date 1029935233 0 # Node ID 7c95cd050e6d7fccdd928fefedb6fd843d344a83 # Parent 2b9f8973f24046bc5b0e6d699254cb5052514c17 (insert_from_gap): Make it work even if PT != GTP. diff -r 2b9f8973f240 -r 7c95cd050e6d src/insdel.c --- a/src/insdel.c Wed Aug 21 12:53:56 2002 +0000 +++ b/src/insdel.c Wed Aug 21 13:07:13 2002 +0000 @@ -1038,19 +1038,16 @@ } /* 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 @@ 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 (); }