patch 8.1.2302: :lockmarks does not work for '[ and ']

Problem:    :lockmarks does not work for '[ and '].
Solution:   save and restore '[ and '] marks. (James McCoy, closes #5222)
diff --git a/src/fileio.c b/src/fileio.c
index 0c2238b..85c5e68 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -188,6 +188,7 @@
 					   wasn't possible */
     char_u	conv_rest[CONV_RESTLEN];
     int		conv_restlen = 0;	/* nr of bytes in conv_rest[] */
+    pos_T	orig_start;
     buf_T	*old_curbuf;
     char_u	*old_b_ffname;
     char_u	*old_b_fname;
@@ -250,9 +251,7 @@
      */
     if (!filtering && !read_stdin && !read_buffer)
     {
-	pos_T	    pos;
-
-	pos = curbuf->b_op_start;
+	orig_start = curbuf->b_op_start;
 
 	/* Set '[ mark to the line above where the lines go (line 1 if zero). */
 	curbuf->b_op_start.lnum = ((from == 0) ? 1 : from);
@@ -276,7 +275,7 @@
 	    return OK;
 #endif
 
-	curbuf->b_op_start = pos;
+	curbuf->b_op_start = orig_start;
     }
 
     if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0)
@@ -617,6 +616,7 @@
     /*
      * Set '[ mark to the line above where the lines go (line 1 if zero).
      */
+    orig_start = curbuf->b_op_start;
     curbuf->b_op_start.lnum = ((from == 0) ? 1 : from);
     curbuf->b_op_start.col = 0;
 
@@ -658,6 +658,7 @@
 	try_mac = (vim_strchr(p_ffs, 'm') != NULL);
 	try_dos = (vim_strchr(p_ffs, 'd') != NULL);
 	try_unix = (vim_strchr(p_ffs, 'x') != NULL);
+	curbuf->b_op_start = orig_start;
 
 	if (msg_scrolled == n)
 	    msg_scroll = m;
@@ -2471,13 +2472,14 @@
 	check_cursor_lnum();
 	beginline(BL_WHITE | BL_FIX);	    /* on first non-blank */
 
-	/*
-	 * Set '[ and '] marks to the newly read lines.
-	 */
-	curbuf->b_op_start.lnum = from + 1;
-	curbuf->b_op_start.col = 0;
-	curbuf->b_op_end.lnum = from + linecnt;
-	curbuf->b_op_end.col = 0;
+	if (!cmdmod.lockmarks)
+	{
+	    // Set '[ and '] marks to the newly read lines.
+	    curbuf->b_op_start.lnum = from + 1;
+	    curbuf->b_op_start.col = 0;
+	    curbuf->b_op_end.lnum = from + linecnt;
+	    curbuf->b_op_end.col = 0;
+	}
 
 #ifdef MSWIN
 	/*