patch 8.2.3018: 'quickfixtextfunc' formatting is lost when switching buffers

Problem:    Formatting using quickfixtextfunc is lost when updating location
            lists for different buffers.  (Yorick Peterse)
Solution:   Use the right window for the locaiton list. (Yegappan Lakshmanan,
            closes #8400, closes #8403)
diff --git a/src/quickfix.c b/src/quickfix.c
index ad07a5b..4974cb4 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -4473,7 +4473,17 @@
 	int		qf_winid = 0;
 
 	if (IS_LL_STACK(qi))
-	    qf_winid = curwin->w_id;
+	{
+	    if (curwin->w_llist == qi)
+		win = curwin;
+	    else
+	    {
+		win = qf_find_win_with_loclist(qi);
+		if (win == NULL)
+		    return;
+	    }
+	    qf_winid = win->w_id;
+	}
 
 	if (old_last == NULL)
 	    // set curwin/curbuf to buf and save a few things