patch 9.0.1714: getcompletion() "cmdline" fails after :autocmd

Problem:  getcompletion() "cmdline" fails after :autocmd
Solution: Use set_cmd_context() instead of set_one_cmd_context().

closes: #12804

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index ba3af3c..b5dec06 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -612,6 +612,8 @@
   call assert_true(index(l, 'taglist(') >= 0)
   let l = getcompletion('call paint', 'cmdline')
   call assert_equal([], l)
+  let l = getcompletion('autocmd BufEnter * map <bu', 'cmdline')
+  call assert_equal(['<buffer>'], l)
 
   func T(a, c, p)
     let g:cmdline_compl_params = [a:a, a:c, a:p]
@@ -3498,14 +3500,15 @@
   call StopVimInTerminal(buf)
 endfunc
 
-func Test_usercmd_completion()
-  let g:complete=[]
+func Test_getcompletion_usercmd()
   command! -nargs=* -complete=command TestCompletion echo <q-args>
-  let g:complete = getcompletion('TestCompletion ', 'cmdline')
-  let a = getcompletion('', 'cmdline')
 
-  call assert_equal(a, g:complete)
+  call assert_equal(getcompletion('', 'cmdline'),
+        \ getcompletion('TestCompletion ', 'cmdline'))
+  call assert_equal(['<buffer>'],
+        \ getcompletion('TestCompletion map <bu', 'cmdline'))
+
   delcom TestCompletion
-  unlet! g:complete
 endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab