diff src/ex_docmd.c @ 17984:2ea47dee7ddd v8.1.1988

patch 8.1.1988: :startinsert! does not work the same way as "A" Commit: https://github.com/vim/vim/commit/8d3b51084a5bdcd2ee9e31bc03cba0d16c43d428 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 5 21:29:01 2019 +0200 patch 8.1.1988: :startinsert! does not work the same way as "A" Problem: :startinsert! does not work the same way as "A". Solution: Use the same code to move the cursor. (closes https://github.com/vim/vim/issues/4896)
author Bram Moolenaar <Bram@vim.org>
date Thu, 05 Sep 2019 21:30:03 +0200
parents 46f95606b9ec
children 1868ec23360e
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -7596,16 +7596,14 @@ ex_startinsert(exarg_T *eap)
 {
     if (eap->forceit)
     {
-	/* cursor line can be zero on startup */
+	// 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;
-    }
-
-    /* Ignore the command when already in Insert mode.  Inserting an
-     * expression register that invokes a function can do this. */
+	set_cursor_for_append_to_line();
+    }
+
+    // Ignore the command when already in Insert mode.  Inserting an
+    // expression register that invokes a function can do this.
     if (State & INSERT)
 	return;
 
@@ -7620,7 +7618,7 @@ ex_startinsert(exarg_T *eap)
     {
 	if (eap->cmdidx == CMD_startinsert)
 	    restart_edit = 'i';
-	curwin->w_curswant = 0;	    /* avoid MAXCOL */
+	curwin->w_curswant = 0;	    // avoid MAXCOL
     }
 }