patch 9.1.0821: 'findexpr' completion doesn't set v:fname to cmdline argument

Problem:  'findexpr' completion doesn't set v:fname to cmdline argument.
Solution: Set v:fname to the cmdline argument as-is (zeertzjq).

closes: #15934

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2024-10-28 22:05:26 +01:00
committed by Christian Brabandt
parent baab7c0865
commit 20e045f781
10 changed files with 75 additions and 38 deletions

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 9.1. Last change: 2024 Oct 22
*options.txt* For Vim version 9.1. Last change: 2024 Oct 28
VIM REFERENCE MANUAL by Bram Moolenaar
@ -3567,6 +3567,10 @@ A jump table for the options with a short description can be found at |Q_op|.
The expression is evaluated only once per |:find| command invocation.
The expression can process all the directories specified in 'path'.
The expression may be evaluated for command-line completion as well,
in which case the |v:cmdcomplete| variable will be set to |v:true|,
otherwise it will be set to |v:false|.
If a match is found, the expression should return a |List| containing
one or more file names. If a match is not found, the expression
should return an empty List.
@ -3586,7 +3590,8 @@ A jump table for the options with a short description can be found at |Q_op|.
>
" Use glob()
func FindExprGlob()
return glob(v:fname, v:false, v:true)
let pat = v:cmdcomplete ? $'{v:fname}*' : v:fname
return glob(pat, v:false, v:true)
endfunc
set findexpr=FindExprGlob()