patch 8.2.4731: the changelist index is not remembered per buffer

Problem:    The changelist index is not remembered per buffer.
Solution:   Keep the changelist index per window and buffer. (closes #10135,
            closes #2173)
diff --git a/src/buffer.c b/src/buffer.c
index 5f8b1ad..50aa9e8 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3076,6 +3076,8 @@
 	wip->wi_fpos.lnum = lnum;
 	wip->wi_fpos.col = col;
     }
+    if (win != NULL)
+	wip->wi_changelistidx = win->w_changelistidx;
     if (copy_options && win != NULL)
     {
 	// Save the window-specific option values.
@@ -3210,6 +3212,8 @@
     }
     else
 	copy_winopt(&curwin->w_allbuf_opt, &curwin->w_onebuf_opt);
+    if (wip != NULL)
+	curwin->w_changelistidx = wip->wi_changelistidx;
 
 #ifdef FEAT_FOLDING
     // Set 'foldlevel' to 'foldlevelstart' if it's not negative.