diff --git a/share/completions/make.fish b/share/completions/make.fish index 2f5f42f3e..6dec6289d 100644 --- a/share/completions/make.fish +++ b/share/completions/make.fish @@ -12,9 +12,13 @@ function __fish_print_make_targets --argument-names directory file if make --version 2>/dev/null | string match -q 'GNU*' # https://stackoverflow.com/a/26339924 make $makeflags -pRrq : 2>/dev/null | - awk -F: '/^# Files/,/^# Finished Make data base/ { + awk -F: -v 'bs_regex=\\\\\\\\' '/^# Files/,/^# Finished Make data base/ { if ($1 == "# Not a target") skip = 1; - if ($1 !~ "^[#.\t]") { if (!skip) print $1; skip=0 } + if ($1 !~ "^[#.\t]" && !is_continuation ) { + if (!skip) print $1; + skip = 0 + } + is_continuation = $0 ~ "^([^#]*[^#" bs_regex "])?(" bs_regex bs_regex ")*" bs_regex "$"; }' 2>/dev/null else # BSD make