diff src/normal.c @ 817:6897668c467f

updated for version 7.0c03
author vimboss
date Wed, 29 Mar 2006 21:06:37 +0000
parents f04f56979d84
children 23f82b5d2814
line wrap: on
line diff
--- a/src/normal.c
+++ b/src/normal.c
@@ -8993,7 +8993,17 @@ nv_put(cap)
 	/* When all lines were selected and deleted do_put() leaves an empty
 	 * line that needs to be deleted now. */
 	if (empty && *ml_get(curbuf->b_ml.ml_line_count) == NUL)
+	{
 	    ml_delete(curbuf->b_ml.ml_line_count, TRUE);
+
+	    /* If the cursor was in that line, move it to the end of the last
+	     * line. */
+	    if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
+	    {
+		curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
+		coladvance((colnr_T)MAXCOL);
+	    }
+	}
 #endif
 	auto_format(FALSE, TRUE);
     }