To: vim-dev@vim.org Subject: patch 7.0.182 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 7.0.182 Problem: When using a mix of undo and "g-" it may no longer be possible to go to every point in the undo tree. (Andy Wokula) Solution: Correctly update pointers in the undo tree. Files: src/undo.c *** ../vim-7.0.181/src/undo.c Tue Aug 29 17:28:56 2006 --- src/undo.c Tue Jan 9 20:18:27 2007 *************** *** 341,351 **** uhp->uh_alt_next = old_curhead; if (old_curhead != NULL) { old_curhead->uh_alt_prev = uhp; if (curbuf->b_u_oldhead == old_curhead) curbuf->b_u_oldhead = uhp; } ! uhp->uh_alt_prev = NULL; if (curbuf->b_u_newhead != NULL) curbuf->b_u_newhead->uh_prev = uhp; --- 341,355 ---- uhp->uh_alt_next = old_curhead; if (old_curhead != NULL) { + uhp->uh_alt_prev = old_curhead->uh_alt_prev; + if (uhp->uh_alt_prev != NULL) + uhp->uh_alt_prev->uh_alt_next = uhp; old_curhead->uh_alt_prev = uhp; if (curbuf->b_u_oldhead == old_curhead) curbuf->b_u_oldhead = uhp; } ! else ! uhp->uh_alt_prev = NULL; if (curbuf->b_u_newhead != NULL) curbuf->b_u_newhead->uh_prev = uhp; *************** *** 856,861 **** --- 860,870 ---- uhp = curbuf->b_u_curhead; while (uhp != NULL) { + /* Go back to the first branch with a mark. */ + while (uhp->uh_alt_prev != NULL + && uhp->uh_alt_prev->uh_walk == mark) + uhp = uhp->uh_alt_prev; + /* Find the last branch with a mark, that's the one. */ last = uhp; while (last->uh_alt_next != NULL *************** *** 865,870 **** --- 874,881 ---- { /* Make the used branch the first entry in the list of * alternatives to make "u" and CTRL-R take this branch. */ + while (uhp->uh_alt_prev != NULL) + uhp = uhp->uh_alt_prev; if (last->uh_alt_next != NULL) last->uh_alt_next->uh_alt_prev = last->uh_alt_prev; last->uh_alt_prev->uh_alt_next = last->uh_alt_next; *** ../vim-7.0.181/src/version.c Tue Jan 9 15:43:39 2007 --- src/version.c Tue Jan 9 20:26:47 2007 *************** *** 668,669 **** --- 668,671 ---- { /* Add new patch number below this line */ + /**/ + 182, /**/ -- hundred-and-one symptoms of being an internet addict: 13. You refer to going to the bathroom as downloading. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///