diff options
author | Miles Bader <miles@gnu.org> | 2005-02-06 12:06:02 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2005-02-06 12:06:02 +0000 |
commit | a359f0e0ff878285654e2f0bcc7bd3b4340c778c (patch) | |
tree | cc0aff13c751bb8ab7ccaae29082bab32e15fd13 /src/insdel.c | |
parent | f3d3402885646e6fa79f1ad59fb8a1f9017851d7 (diff) | |
parent | 56c30d721096a64f151f9ea6e3c76562380da895 (diff) | |
download | emacs-a359f0e0ff878285654e2f0bcc7bd3b4340c778c.tar.gz emacs-a359f0e0ff878285654e2f0bcc7bd3b4340c778c.tar.bz2 emacs-a359f0e0ff878285654e2f0bcc7bd3b4340c778c.zip |
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-11
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-69
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-71
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-72
src/dispextern.h (xassert): Enable unconditionally.
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-73
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-81
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-82
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-12
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-13
Update from CVS
Diffstat (limited to 'src/insdel.c')
-rw-r--r-- | src/insdel.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/insdel.c b/src/insdel.c index aec393692a2..c2ee9a94674 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1,5 +1,5 @@ /* Buffer insertion/deletion and gap motion for GNU Emacs. - Copyright (C) 1985, 86,93,94,95,97,98, 1999, 2000, 01, 2003 + Copyright (C) 1985, 86,93,94,95,97,98, 1999, 2000, 01, 2003, 2005 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -1778,17 +1778,21 @@ replace_range_2 (from, from_byte, to, to_byte, ins, inschars, insbytes, markers) /* Adjust markers for the deletion and the insertion. */ if (markers - && ! (nchars_del == 1 && inschars == 1)) + && ! (nchars_del == 1 && inschars == 1 && nbytes_del == insbytes)) adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del, inschars, insbytes); offset_intervals (current_buffer, from, inschars - nchars_del); /* Relocate point as if it were a marker. */ - if (from < PT && nchars_del != inschars) - adjust_point ((from + inschars - (PT < to ? PT : to)), - (from_byte + insbytes - - (PT_BYTE < to_byte ? PT_BYTE : to_byte))); + if (from < PT && (nchars_del != inschars || nbytes_del != insbytes)) + { + if (PT < to) + /* PT was within the deleted text. Move it to FROM. */ + adjust_point (from - PT, from_byte - PT_BYTE); + else + adjust_point (inschars - nchars_del, insbytes - nbytes_del); + } if (insbytes == 0) evaporate_overlays (from); |