Found while investigating a llvm report. Since this doesn't actually
do anything, the dot handling of undo (i.e. move dot to where an undo
is happening) is fine afaic, I'd like to remove this. Unless someone
has a diff to make this useful...

Also note the rather elaborate way an int is set to zero ;)

diff --git buffer.c buffer.c
index a2e84ab..a01f92d 100644
--- buffer.c
+++ buffer.c
@@ -543,7 +543,6 @@ bnew(const char *bname)
        bp->b_nmodes = defb_nmodes;
        TAILQ_INIT(&bp->b_undo);
        bp->b_undoptr = NULL;
-       memset(&bp->b_undopos, 0, sizeof(bp->b_undopos));
        i = 0;
        do {
                bp->b_modes[i] = defb_modes[i];
diff --git def.h def.h
index 2efe5cc..39c6409 100644
--- def.h
+++ def.h
@@ -260,7 +260,6 @@ struct buffer {
        char             b_cwd[NFILEN]; /* working directory             */
        struct fileinfo  b_fi;          /* File attributes               */
        struct undoq     b_undo;        /* Undo actions list             */
-       int              b_undopos;     /* Where we were during last undo */
        struct undo_rec *b_undoptr;
        int              b_dotline;     /* Line number of dot */
        int              b_markline;    /* Line number of mark */
diff --git undo.c undo.c
index 1efd2a1..2140b66 100644
--- undo.c
+++ undo.c
@@ -464,15 +464,13 @@ undo(int f, int n)
        struct undo_rec *ptr, *nptr;
        int              done, rval;
        struct line     *lp;
-       int              offset, save, dot;
+       int              offset, save;
        static int       nulled = FALSE;
        int              lineno;
 
        if (n < 0)
                return (FALSE);
 
-       dot = find_dot(curwp->w_dotp, curwp->w_doto);
-
        ptr = curbp->b_undoptr;
 
        /* first invocation, make ptr point back to the top of the list */
@@ -573,13 +571,8 @@ undo(int f, int n)
 
                ewprintf("Undo!");
        }
-       /*
-        * Record where we are. (we have to save our new position at the end
-        * since we change the dot when undoing....)
-        */
-       curbp->b_undoptr = ptr;
 
-       curbp->b_undopos = find_dot(curwp->w_dotp, curwp->w_doto);
+       curbp->b_undoptr = ptr;
 
        return (rval);
 }

-- 
I'm not entirely sure you are real.

Reply via email to