Fix formating

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
pull/7690/head
Marc Khouzam 6 years ago
parent e38d3e8b8f
commit 26a9e3f62f

@ -278,45 +278,45 @@ function __helm_handle_completion
end end
__helm_debug "emptyArg: $emptyArg" __helm_debug "emptyArg: $emptyArg"
set requestComp "$args[1] %[1]s $args[2..-1] $emptyArg" set requestComp "$args[1] %[1]s $args[2..-1] $emptyArg"
__helm_debug "Calling $requestComp" __helm_debug "Calling $requestComp"
eval $requestComp 2> /dev/null eval $requestComp 2> /dev/null
end end
function __helm_get_completions function __helm_get_completions
# Use the cache if possible # Use the cache if possible
if not set -q __helm_cache_completions if not set -q __helm_cache_completions
set -g __helm_cache_completions (__helm_handle_completion (commandline)) set -g __helm_cache_completions (__helm_handle_completion (commandline))
__helm_debug "Populating completion cache with: $__helm_cache_completions" __helm_debug "Populating completion cache with: $__helm_cache_completions"
end end
set -l directive (string sub --start 2 $__helm_cache_completions[-1]) set -l directive (string sub --start 2 $__helm_cache_completions[-1])
set -l comps $__helm_cache_completions[1..-2] set -l comps $__helm_cache_completions[1..-2]
__helm_debug "Completions are: $comps" __helm_debug "Completions are: $comps"
__helm_debug "Directive is: $directive" __helm_debug "Directive is: $directive"
set -l compErr (math (math $directive / %[2]d) %% 2) set -l compErr (math (math $directive / %[2]d) %% 2)
if test $compErr -eq 1 if test $compErr -eq 1
return 0 return 0
end end
set -l nospace (math (math $directive / %[3]d) %% 2) set -l nospace (math (math $directive / %[3]d) %% 2)
set -l nofiles (math (math $directive / %[4]d) %% 2) set -l nofiles (math (math $directive / %[4]d) %% 2)
__helm_debug "nospace: $nospace, nofiles: $nofiles" __helm_debug "nospace: $nospace, nofiles: $nofiles"
for i in $comps for i in $comps
printf "%%s\n" $i printf "%%s\n" $i
end end
if test (count $comps) -eq 1; and test $nospace -ne 0 if test (count $comps) -eq 1; and test $nospace -ne 0
# To support the "nospace" directive we trick the shell # To support the "nospace" directive we trick the shell
# by outputting an extra, longer completion. # by outputting an extra, longer completion.
printf "%%s\n" $comps[1]. printf "%%s\n" $comps[1].
end end
# Return true if no file completion should be done # Return true if no file completion should be done
test (count $comps) -gt 0; or test $nofiles -ne 0 test (count $comps) -gt 0; or test $nofiles -ne 0
end end
# Remove any pre-existing helm completions since we will be handling all of them # Remove any pre-existing helm completions since we will be handling all of them

Loading…
Cancel
Save