summaryrefslogtreecommitdiff
path: root/shell/completion.zsh
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2023-10-02 20:40:49 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2023-10-02 20:40:49 +0900
commitee4ba104e722960376988e4e6971b5c5c271c643 (patch)
tree92ba247fc970ae84c694674f9ea960955c045ddf /shell/completion.zsh
parent4fdc08295b90485b7ee30a35d77177699c070113 (diff)
downloadfzf-ee4ba104e722960376988e4e6971b5c5c271c643.tar.gz
[completion] Prevent running a command during 'eval'
Do not attempt to provide fuzzy completion if the prefix contains a pattern that may start an arbitraty command. * $(...) * `...` * <(...) Close #3459
Diffstat (limited to 'shell/completion.zsh')
-rw-r--r--shell/completion.zsh6
1 files changed, 6 insertions, 0 deletions
diff --git a/shell/completion.zsh b/shell/completion.zsh
index ec2dfdef..fe62b9a8 100644
--- a/shell/completion.zsh
+++ b/shell/completion.zsh
@@ -137,6 +137,9 @@ __fzf_generic_path_completion() {
tail=$6
setopt localoptions nonomatch
+ if [[ $base = *'$('* ]] || [[ $base = *'<('* ]] || [[ $base = *'`'* ]]; then
+ return
+ fi
eval "base=$base"
[[ $base = *"/"* ]] && dir="$base"
while [ 1 ]; do
@@ -304,6 +307,9 @@ fzf-completion() {
d_cmds=(${=FZF_COMPLETION_DIR_COMMANDS:-cd pushd rmdir})
[ -z "$trigger" ] && prefix=${tokens[-1]} || prefix=${tokens[-1]:0:-${#trigger}}
+ if [[ $prefix = *'$('* ]] || [[ $prefix = *'<('* ]] || [[ $prefix = *'`'* ]]; then
+ return
+ fi
[ -n "${tokens[-1]}" ] && lbuf=${lbuf:0:-${#tokens[-1]}}
if eval "type _fzf_complete_${cmd} > /dev/null"; then