diff src/ex_docmd.c @ 12545:241fbf588b95 v8.0.1151

patch 8.0.1151: "vim -c startinsert!" doesn't append commit https://github.com/vim/vim/commit/09ca932f8e7d63a83b39baa7c03d4c6145e3baab Author: Bram Moolenaar <Bram@vim.org> Date: Tue Sep 26 17:40:45 2017 +0200 patch 8.0.1151: "vim -c startinsert!" doesn't append Problem: "vim -c startinsert!" doesn't append. Solution: Correct line number on startup. (Christian Brabandt, closes https://github.com/vim/vim/issues/2117)
author Christian Brabandt <cb@256bit.org>
date Tue, 26 Sep 2017 17:45:04 +0200
parents 718787498836
children e8929ded6f43
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -10294,6 +10294,9 @@ ex_startinsert(exarg_T *eap)
 {
     if (eap->forceit)
     {
+	/* cursor line can be zero on startup */
+	if (!curwin->w_cursor.lnum)
+	    curwin->w_cursor.lnum = 1;
 	coladvance((colnr_T)MAXCOL);
 	curwin->w_curswant = MAXCOL;
 	curwin->w_set_curswant = FALSE;