From be67148ca8c270f6befc55e24a72da0427ce73c6 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Mon, 17 Jun 2002 21:33:34 +0000 Subject: [PATCH] (insert_1_both, insert_from_string_1) (insert_from_buffer_1): Recalculate END_UNCHANGED in case the insert happened in the end_unchanged region. Otherwise, the redisplay may be confused and duplicate the last line in the buffer [seen after save-buffer when require-final-newline==t]. --- src/insdel.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/insdel.c b/src/insdel.c index 3383f4e56e2..4fdae3a8609 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -959,6 +959,10 @@ insert_1_both (string, nchars, nbytes, inherit, prepare, before_markers) if (GPT_BYTE < GPT) abort (); + /* The insert may have been in the unchanged region, so check again. */ + if (Z - GPT < END_UNCHANGED) + END_UNCHANGED = Z - GPT; + adjust_overlays_for_insert (PT, nchars); adjust_markers_for_insert (PT, PT_BYTE, PT + nchars, PT_BYTE + nbytes, @@ -1082,6 +1086,10 @@ insert_from_string_1 (string, pos, pos_byte, nchars, nbytes, if (GPT_BYTE < GPT) abort (); + /* The insert may have been in the unchanged region, so check again. */ + if (Z - GPT < END_UNCHANGED) + END_UNCHANGED = Z - GPT; + adjust_overlays_for_insert (PT, nchars); adjust_markers_for_insert (PT, PT_BYTE, PT + nchars, PT_BYTE + outgoing_nbytes, @@ -1229,6 +1237,10 @@ insert_from_buffer_1 (buf, from, nchars, inherit) if (GPT_BYTE < GPT) abort (); + /* The insert may have been in the unchanged region, so check again. */ + if (Z - GPT < END_UNCHANGED) + END_UNCHANGED = Z - GPT; + adjust_overlays_for_insert (PT, nchars); adjust_markers_for_insert (PT, PT_BYTE, PT + nchars, PT_BYTE + outgoing_nbytes, -- 2.39.2