about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Completion/bashcompinit5
2 files changed, 6 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f18fe4e94..140a3f07c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2021-12-02  Oliver Kiddle  <opk@zsh.org>
 
+	* 49630: Completion/bashcompinit: allow zsh to quote matches but
+	include a special case for space suffixes
+
 	* 49631: Completion/Unix/Command/_logger: new logger completion
 
 	* 49629: Completion/Linux/Command/_perf: new Linux perf completion
diff --git a/Completion/bashcompinit b/Completion/bashcompinit
index b278ac8f4..adb659ca1 100644
--- a/Completion/bashcompinit
+++ b/Completion/bashcompinit
@@ -24,9 +24,10 @@ _bash_complete() {
     if [[ ${argv[${argv[(I)filenames]:-0}-1]} = -o ]]; then
       compset -P '*/' && matches=( ${matches##*/} )
       compset -S '/*' && matches=( ${matches%%/*} )
-      compadd -Q -f "${suf[@]}" -a matches && ret=0
+      compadd -f "${suf[@]}" -a matches && ret=0
     else
-      compadd -Q "${suf[@]}" -a matches && ret=0
+      compadd "${suf[@]}" - "${(@)${(Q@)matches}:#*\ }" && ret=0
+      compadd -S ' ' - ${${(M)${(Q)matches}:#*\ }% } && ret=0
     fi
   fi