From 38502301e58077a6dc475691396e40d018f01365 Mon Sep 17 00:00:00 2001 From: Paul Seyfert Date: Mon, 3 Jan 2022 12:55:33 +0100 Subject: [PATCH] [Completion] apply compadd replacements during prefix replacement --- Completion/Unix/Type/_canonical_paths | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Completion/Unix/Type/_canonical_paths b/Completion/Unix/Type/_canonical_paths index a8fbbb5245..eb4932ac18 100644 --- a/Completion/Unix/Type/_canonical_paths +++ b/Completion/Unix/Type/_canonical_paths @@ -42,7 +42,13 @@ _canonical_paths_add_paths () { # ### Ideally, this codepath would do what the 'if' above does, # ### but telling compadd to pretend the "word on the command line" # ### is ${"the word on the command line"/$origpref/$canpref}. - matches+=(${${(M)files:#$canpref*}/$canpref/$origpref}) + () { + local -a tmp_buffer tmp_buffer2 + tmp_buffer=(${${(M)files:#$canpref*}/$canpref/$origpref}) + compadd -A tmp_buffer2 "$__gopts[@]" -a tmp_buffer + matches+=($tmp_buffer2) + } + # matches+=(${${(M)files:#$canpref*}/$canpref/$origpref}) fi for subdir in $expref?*(@); do