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/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index b0914d9..ee66418 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -373,6 +373,14 @@
   set completeopt&
 endfunc
 
+func s:ComplInCmdwin_GlobalCompletion(a, l, p)
+  return 'global'
+endfunc
+
+func s:ComplInCmdwin_LocalCompletion(a, l, p)
+  return 'local'
+endfunc
+
 func Test_compl_in_cmdwin()
   CheckFeature cmdwin
 
@@ -411,6 +419,47 @@
   call feedkeys("q::GetInput b:test_\<Tab>\<CR>:q\<CR>", 'tx!')
   call assert_equal('b:test_', input)
 
+
+  " Argument completion of buffer-local command
+  func s:ComplInCmdwin_GlobalCompletionList(a, l, p)
+    return ['global']
+  endfunc
+
+  func s:ComplInCmdwin_LocalCompletionList(a, l, p)
+    return ['local']
+  endfunc
+
+  func s:ComplInCmdwin_CheckCompletion(arg)
+    call assert_equal('local', a:arg)
+  endfunc
+
+  com! -nargs=1 -complete=custom,<SID>ComplInCmdwin_GlobalCompletion
+       \ TestCommand call s:ComplInCmdwin_CheckCompletion(<q-args>)
+  com! -buffer -nargs=1 -complete=custom,<SID>ComplInCmdwin_LocalCompletion
+       \ TestCommand call s:ComplInCmdwin_CheckCompletion(<q-args>)
+  call feedkeys("q:iTestCommand \<Tab>\<CR>", 'tx!')
+
+  com! -nargs=1 -complete=customlist,<SID>ComplInCmdwin_GlobalCompletionList
+       \ TestCommand call s:ComplInCmdwin_CheckCompletion(<q-args>)
+  com! -buffer -nargs=1 -complete=customlist,<SID>ComplInCmdwin_LocalCompletionList
+       \ TestCommand call s:ComplInCmdwin_CheckCompletion(<q-args>)
+
+  call feedkeys("q:iTestCommand \<Tab>\<CR>", 'tx!')
+
+  func! s:ComplInCmdwin_CheckCompletion(arg)
+    call assert_equal('global', a:arg)
+  endfunc
+  new
+  call feedkeys("q:iTestCommand \<Tab>\<CR>", 'tx!')
+  quit
+
+  delfunc s:ComplInCmdwin_GlobalCompletion
+  delfunc s:ComplInCmdwin_LocalCompletion
+  delfunc s:ComplInCmdwin_GlobalCompletionList
+  delfunc s:ComplInCmdwin_LocalCompletionList
+  delfunc s:ComplInCmdwin_CheckCompletion
+
+  delcom -buffer TestCommand
   delcom TestCommand
   delcom GetInput
   unlet w:test_winvar