From 1173e8bda41b48eedbd141c29c633993380d5497 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 2 Oct 2020 05:48:55 +0200 Subject: [PATCH] Clarify that some complete calls just need a command with no user-defined completion --- share/completions/gitk.fish | 2 +- share/functions/__fish_complete_suffix.fish | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/share/completions/gitk.fish b/share/completions/gitk.fish index c449460a9..de62ece4b 100644 --- a/share/completions/gitk.fish +++ b/share/completions/gitk.fish @@ -20,7 +20,7 @@ complete -c gitk -n 'not contains -- -- (commandline -opc)' -xa -L1 -d '-L: trace the evolution of a function name regex' complete -c gitk -n 'not contains -- -- (commandline -opc) && string match -rq -- "^-L[^:]*": (commandline -ct)' -xa '( set -l tok (string split -m 1 -- : (commandline -ct)) - printf -- "$tok[1]:%s\n" (complete -C": $tok[2]") + printf -- "$tok[1]:%s\n" (complete -C"__fish_command_without_completions $tok[2]") )' complete -c gitk -f -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_ranges)' complete -c gitk -F -n 'contains -- -- (commandline -opc)' diff --git a/share/functions/__fish_complete_suffix.fish b/share/functions/__fish_complete_suffix.fish index 153b19f07..5d0402dd8 100644 --- a/share/functions/__fish_complete_suffix.fish +++ b/share/functions/__fish_complete_suffix.fish @@ -51,9 +51,8 @@ function __fish_complete_suffix -d "Complete using files" # Simple and common case: no prefix, just complete normally and filter out unwanted suffixes. if test -z $prefix set -l suffix (string escape --style=regex -- $suff) - # Use normal file completions. Any valid command works here as, as long as it has no - # user-defined completions. The builtin ":" should work. - set files (complete -C ": $comp" | string match -r "^.*(?:$suffix|/)\$") + # Use normal file completions. + set files (complete -C "__fish_command_without_completions $comp" | string match -r "^.*(?:$suffix|/)\$") else # Strip leading ./ as it confuses the detection of base and suffix # It is conditionally re-added below.