patch 8.2.3629: command completion in cmdline window uses global commands

Problem:    Command completion in cmdline window uses global user commands,
            not local commands for the window where it was opened from.
Solution:   Use local commands. (closes #9168)
diff --git a/src/usercmd.c b/src/usercmd.c
index 0050647..332f995 100644
--- a/src/usercmd.c
+++ b/src/usercmd.c
@@ -141,7 +141,11 @@
     /*
      * Look for buffer-local user commands first, then global ones.
      */
-    gap = &curbuf->b_ucmds;
+    gap =
+#ifdef FEAT_CMDWIN
+	is_in_cmdwin() ? &prevwin->w_buffer->b_ucmds :
+#endif
+	&curbuf->b_ucmds;
     for (;;)
     {
 	for (j = 0; j < gap->ga_len; ++j)
@@ -303,7 +307,7 @@
     // In cmdwin, the alternative buffer should be used.
     buf_T *buf =
 #ifdef FEAT_CMDWIN
-	(cmdwin_type != 0 && get_cmdline_type() == NUL) ? prevwin->w_buffer :
+	is_in_cmdwin() ? prevwin->w_buffer :
 #endif
 	curbuf;
 
@@ -330,10 +334,9 @@
 	// In cmdwin, the alternative buffer should be used.
 	buf_T *buf =
 #ifdef FEAT_CMDWIN
-		    (cmdwin_type != 0 && get_cmdline_type() == NUL)
-							  ? prevwin->w_buffer :
+		    is_in_cmdwin() ? prevwin->w_buffer :
 #endif
-	    curbuf;
+		    curbuf;
 
 	if (idx < buf->b_ucmds.ga_len)
 	    return USER_CMD_GA(&buf->b_ucmds, idx)->uc_name;
@@ -420,10 +423,9 @@
     // In cmdwin, the alternative buffer should be used.
     gap =
 #ifdef FEAT_CMDWIN
-	(cmdwin_type != 0 && get_cmdline_type() == NUL) ?
-	&prevwin->w_buffer->b_ucmds :
+	    is_in_cmdwin() ? &prevwin->w_buffer->b_ucmds :
 #endif
-	&curbuf->b_ucmds;
+	    &curbuf->b_ucmds;
     for (;;)
     {
 	for (i = 0; i < gap->ga_len; ++i)