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 #4896)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index ef86ae5..0e0e1b8 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -7596,16 +7596,14 @@
 {
     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;
+	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. */
+    // 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 @@
     {
 	if (eap->cmdidx == CMD_startinsert)
 	    restart_edit = 'i';
-	curwin->w_curswant = 0;	    /* avoid MAXCOL */
+	curwin->w_curswant = 0;	    // avoid MAXCOL
     }
 }
 
diff --git a/src/normal.c b/src/normal.c
index 1db1d16..7abd3fc 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -8898,6 +8898,27 @@
 }
 
 /*
+ * Move the cursor for the "A" command.
+ */
+    void
+set_cursor_for_append_to_line(void)
+{
+    curwin->w_set_curswant = TRUE;
+    if (ve_flags == VE_ALL)
+    {
+	int save_State = State;
+
+	/* Pretend Insert mode here to allow the cursor on the
+	 * character past the end of the line */
+	State = INSERT;
+	coladvance((colnr_T)MAXCOL);
+	State = save_State;
+    }
+    else
+	curwin->w_cursor.col += (colnr_T)STRLEN(ml_get_cursor());
+}
+
+/*
  * Handle "A", "a", "I", "i" and <Insert> commands.
  * Also handle K_PS, start bracketed paste.
  */
@@ -8983,19 +9004,7 @@
 	switch (cap->cmdchar)
 	{
 	    case 'A':	/* "A"ppend after the line */
-		curwin->w_set_curswant = TRUE;
-		if (ve_flags == VE_ALL)
-		{
-		    int save_State = State;
-
-		    /* Pretend Insert mode here to allow the cursor on the
-		     * character past the end of the line */
-		    State = INSERT;
-		    coladvance((colnr_T)MAXCOL);
-		    State = save_State;
-		}
-		else
-		    curwin->w_cursor.col += (colnr_T)STRLEN(ml_get_cursor());
+		set_cursor_for_append_to_line();
 		break;
 
 	    case 'I':	/* "I"nsert before the first non-blank */
diff --git a/src/proto/normal.pro b/src/proto/normal.pro
index cc4bf7d..dd62226 100644
--- a/src/proto/normal.pro
+++ b/src/proto/normal.pro
@@ -23,4 +23,5 @@
 int get_visual_text(cmdarg_T *cap, char_u **pp, int *lenp);
 void start_selection(void);
 void may_start_select(int c);
+void set_cursor_for_append_to_line(void);
 /* vim: set ft=c : */
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index 799642d..6ee5848 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -1480,3 +1480,18 @@
 
   close!
 endfunc
+
+func Test_edit_startinsert()
+  new
+  set backspace+=start
+  call setline(1, 'foobar')
+  call feedkeys("A\<C-U>\<Esc>", 'xt')
+  call assert_equal('', getline(1))
+
+  call setline(1, 'foobar')
+  call feedkeys(":startinsert!\<CR>\<C-U>\<Esc>", 'xt')
+  call assert_equal('', getline(1))
+
+  set backspace&
+  bwipe!
+endfunc
diff --git a/src/version.c b/src/version.c
index 420d1ff..52e12ee 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1988,
+/**/
     1987,
 /**/
     1986,