From 12e5c2f07da77ef6661e653df421b5df4441ba7f Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 17 Feb 2020 11:32:03 +0100 Subject: [PATCH] undo: for an automatic hard-wrap, store the correct previous buffer size The SPLIT_BEGIN item gets tucked underneath the ADD item on the top of the undo stack. Thus: that SPLIT_BEGIN item should copy the 'wassize' of the ADD item instead of storing the current buffer size. This fixes https://savannah.gnu.org/bugs/?57832. Bug existed since the undo functionality was added, and existed in this form since version 2.3.5, commit be10c2a4. --- src/text.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/text.c b/src/text.c index 264869b4..2c67a7cf 100644 --- a/src/text.c +++ b/src/text.c @@ -1142,6 +1142,7 @@ void add_undo(undo_type action, const char *message) * SPLIT_BEGIN item underneath that action's undo item. Otherwise, * just add the new item to the top of the undo stack. */ if (u->type == SPLIT_BEGIN) { + u->wassize = openfile->undotop->wassize; u->next = openfile->undotop->next; openfile->undotop->next = u; } else