diff src/undo.c @ 12827:ff494a964ab7 v8.0.1290

patch 8.0.1290: seq_cur of undotree() wrong after undo commit https://github.com/vim/vim/commit/80eaddd3a0bc47cb14168964678420cfe03a2502 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 11 23:37:08 2017 +0100 patch 8.0.1290: seq_cur of undotree() wrong after undo Problem: seq_cur of undotree() wrong after undo. Solution: Get the actual sequence number instead of decrementing the current one. (Ozaki Kiichi, closes #2319)
author Christian Brabandt <cb@256bit.org>
date Sat, 11 Nov 2017 23:45:05 +0100
parents 351cf7c67bbe
children 8d5b451d7bab
line wrap: on
line diff
--- a/src/undo.c
+++ b/src/undo.c
@@ -2863,9 +2863,14 @@ u_undoredo(int undo)
     /* Remember where we are for "g-" and ":earlier 10s". */
     curbuf->b_u_seq_cur = curhead->uh_seq;
     if (undo)
+    {
 	/* We are below the previous undo.  However, to make ":earlier 1s"
 	 * work we compute this as being just above the just undone change. */
-	--curbuf->b_u_seq_cur;
+	if (curhead->uh_next.ptr != NULL)
+	    curbuf->b_u_seq_cur = curhead->uh_next.ptr->uh_seq;
+	else
+	    curbuf->b_u_seq_cur = 0;
+    }
 
     /* Remember where we are for ":earlier 1f" and ":later 1f". */
     if (curhead->uh_save_nr != 0)