From: Bram Moolenaar Date: Mon, 24 May 2010 20:06:04 +0000 (+0200) Subject: And another small fix for persistent undo. X-Git-Tag: v7.3~353 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d72807646363a7b1570f42517b308ac2fe8ef65;p=vim And another small fix for persistent undo. --- diff --git a/src/undo.c b/src/undo.c index 35a907fa8..35fa31064 100644 --- a/src/undo.c +++ b/src/undo.c @@ -1025,10 +1025,10 @@ u_read_undo(name, hash) { /* If we've had to move from the rightmost side of the table, * we have to shift everything to the right by one spot. */ - if (i < num_read_uhps - 1) + if (num_read_uhps - i - 1 > 0) { memmove(uhp_table + i + 2, uhp_table + i + 1, - (num_read_uhps - i) * sizeof(u_header_T *)); + (num_read_uhps - i - 1) * sizeof(u_header_T *)); } uhp_table[i + 1] = uhp; break;