Fix funced to not expand or execute function name when interactive

Due to unnecessary quotes in the prompt command given to `read` by `funced` when
editing a function interactively (using `-i`), the name of the function to edit
would be evaluated, expanded and even executed (when using command substitution
for example), which is at least annoying when using unusual but valid and
allowed function names like '*' or 'head (cat)'. This commit delays the function
name expansion so that this should no longer happen.
This commit is contained in:
phisonate
2025-07-21 22:13:22 +02:00
parent db0f9c1d53
commit 51f3722e02

View File

@@ -47,7 +47,7 @@ function funced --description 'Edit function definition'
functions --no-details -- $funcname | __fish_indent --only-unindent | __fish_indent --no-indent | read -z init
end
set -l prompt 'printf "%s%s%s> " (set_color green) '$funcname' (set_color normal)'
set -l prompt 'printf "%s%s%s> " (set_color green) $funcname (set_color normal)'
if read -p $prompt -c "$init" --shell cmd
echo -n $cmd | __fish_indent --only-unindent | read -lz cmd
eval "$cmd"