patch 8.2.3638: getcompletion() always passes zero as position
Problem: getcompletion() always passes zero as position to custom
completion function.
Solution: Pass the pattern length. (closes #9173)
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 295e59d..abd1246 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -424,14 +424,17 @@
call assert_equal([], l)
func T(a, c, p)
+ let g:cmdline_compl_params = [a:a, a:c, a:p]
return "oneA\noneB\noneC"
endfunc
command -nargs=1 -complete=custom,T MyCmd
let l = getcompletion('MyCmd ', 'cmdline')
call assert_equal(['oneA', 'oneB', 'oneC'], l)
+ call assert_equal(['', 'MyCmd ', 6], g:cmdline_compl_params)
delcommand MyCmd
delfunc T
+ unlet g:cmdline_compl_params
" For others test if the name is recognized.
let names = ['buffer', 'environment', 'file_in_path', 'mapping', 'tag', 'tag_listfiles', 'user']