]> granicus.if.org Git - vim/commitdiff
Fix: ml_get errors when using undo with 'virtualedit'.
authorBram Moolenaar <Bram@vim.org>
Sat, 7 Aug 2010 10:54:12 +0000 (12:54 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 7 Aug 2010 10:54:12 +0000 (12:54 +0200)
src/undo.c

index 1b7419725bda1764965faccf5b6ebb4c453d9ec7..376913d538f8864518cc7186a886ed12604ab877 100644 (file)
@@ -2591,18 +2591,21 @@ u_undoredo(undo)
     if (curhead->uh_cursor.lnum + 1 == curwin->w_cursor.lnum
                                                 && curwin->w_cursor.lnum > 1)
        --curwin->w_cursor.lnum;
-    if (curhead->uh_cursor.lnum == curwin->w_cursor.lnum)
+    if (curwin->w_cursor.lnum <= curbuf->b_ml.ml_line_count)
     {
-       curwin->w_cursor.col = curhead->uh_cursor.col;
+       if (curhead->uh_cursor.lnum == curwin->w_cursor.lnum)
+       {
+           curwin->w_cursor.col = curhead->uh_cursor.col;
 #ifdef FEAT_VIRTUALEDIT
-       if (virtual_active() && curhead->uh_cursor_vcol >= 0)
-           coladvance((colnr_T)curhead->uh_cursor_vcol);
-       else
-           curwin->w_cursor.coladd = 0;
+           if (virtual_active() && curhead->uh_cursor_vcol >= 0)
+               coladvance((colnr_T)curhead->uh_cursor_vcol);
+           else
+               curwin->w_cursor.coladd = 0;
 #endif
+       }
+       else
+           beginline(BL_SOL | BL_FIX);
     }
-    else if (curwin->w_cursor.lnum <= curbuf->b_ml.ml_line_count)
-       beginline(BL_SOL | BL_FIX);
     else
     {
        /* We get here with the current cursor line being past the end (eg