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/register.c b/src/register.c
index 2e83840..ee7c618 100644
--- a/src/register.c
+++ b/src/register.c
@@ -1316,13 +1316,16 @@
 	}
     }
 
-    // Set "'[" and "']" marks.
-    curbuf->b_op_start = oap->start;
-    curbuf->b_op_end = oap->end;
-    if (yanktype == MLINE && !oap->block_mode)
+    if (!cmdmod.lockmarks)
     {
-	curbuf->b_op_start.col = 0;
-	curbuf->b_op_end.col = MAXCOL;
+	// Set "'[" and "']" marks.
+	curbuf->b_op_start = oap->start;
+	curbuf->b_op_end = oap->end;
+	if (yanktype == MLINE && !oap->block_mode)
+	{
+	    curbuf->b_op_start.col = 0;
+	    curbuf->b_op_end.col = MAXCOL;
+	}
     }
 
 #ifdef FEAT_CLIPBOARD
@@ -1474,6 +1477,8 @@
     char_u	*insert_string = NULL;
     int		allocated = FALSE;
     long	cnt;
+    pos_T	orig_start = curbuf->b_op_start;
+    pos_T	orig_end = curbuf->b_op_end;
 
 #ifdef FEAT_CLIPBOARD
     // Adjust register name for "unnamed" in 'clipboard'.
@@ -2100,6 +2105,11 @@
     curwin->w_set_curswant = TRUE;
 
 end:
+    if (cmdmod.lockmarks)
+    {
+	curbuf->b_op_start = orig_start;
+	curbuf->b_op_end = orig_end;
+    }
     if (allocated)
 	vim_free(insert_string);
     if (regname == '=')