patch 9.1.0526: Unwanted cursor movement with pagescroll at start of buffer

Problem:  Cursor is moved to bottom of window trying to pagescroll when
          already at the start of the buffer (Asheq Imran, after v9.1.0357)
Solution: Don't move cursor when buffer content did not move.
          (Luuk van Baal)

closes: #15139

Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/move.c b/src/move.c
index 71654dd..f2780e5 100644
--- a/src/move.c
+++ b/src/move.c
@@ -3281,10 +3281,13 @@
 				MAX(1, p_window - 2) : get_scroll_overlap(dir));
 	nochange = scroll_with_sms(dir, count, &count);
 
-	// Place cursor at top or bottom of window.
-	validate_botline();
-	curwin->w_cursor.lnum = (dir == FORWARD ? curwin->w_topline
+	if (!nochange)
+	{
+	    // Place cursor at top or bottom of window.
+	    validate_botline();
+	    curwin->w_cursor.lnum = (dir == FORWARD ? curwin->w_topline
 						    : curwin->w_botline - 1);
+	}
     }
 
     if (get_scrolloff_value() > 0)