diff src/ops.c @ 557:862863033fdd v7.0158

updated for version 7.0158
author vimboss
date Wed, 23 Nov 2005 21:25:05 +0000
parents a5efb97bc104
children d220eb88e4e4
line wrap: on
line diff
--- a/src/ops.c
+++ b/src/ops.c
@@ -3724,13 +3724,17 @@ end:
 	    && curwin->w_cursor.col > 0
 	    && !(restart_edit || (State & INSERT)))
     {
-#ifdef FEAT_VIRTUALEDIT
-	col = curwin->w_cursor.col;
-#endif
+	/* Put the cursor on the last character in the line. */
 	dec_cursor();
 #ifdef FEAT_VIRTUALEDIT
 	if (ve_flags == VE_ALL)
-	    curwin->w_cursor.coladd = col - curwin->w_cursor.col;
+	{
+	    colnr_T	    scol, ecol;
+
+	    /* Coladd is set to the width of the last character. */
+	    getvcol(curwin, &curwin->w_cursor, &scol, NULL, &ecol);
+	    curwin->w_cursor.coladd = ecol - scol + 1;
+	}
 #endif
     }
 }