patch 8.2.2711: "gj" in a closed fold does not move out of the fold

Problem:    "gj" in a closed fold does not move out of the fold. (Marco Hinz)
Solution:   Add a check for being in a closed fold. (closes #8062)
diff --git a/src/normal.c b/src/normal.c
index 4299a90..a15ae35 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -2564,7 +2564,11 @@
       {
 	if (dir == BACKWARD)
 	{
-	    if ((long)curwin->w_curswant >= width1)
+	    if ((long)curwin->w_curswant >= width1
+#ifdef FEAT_FOLDING
+		    && !hasFolding(curwin->w_cursor.lnum, NULL, NULL)
+#endif
+	       )
 		// Move back within the line. This can give a negative value
 		// for w_curswant if width1 < width2 (with cpoptions+=n),
 		// which will get clipped to column 0.
@@ -2598,7 +2602,11 @@
 		n = ((linelen - width1 - 1) / width2 + 1) * width2 + width1;
 	    else
 		n = width1;
-	    if (curwin->w_curswant + width2 < (colnr_T)n)
+	    if (curwin->w_curswant + width2 < (colnr_T)n
+#ifdef FEAT_FOLDING
+		    && !hasFolding(curwin->w_cursor.lnum, NULL, NULL)
+#endif
+		    )
 		// move forward within line
 		curwin->w_curswant += width2;
 	    else