about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/User/_man9
1 files changed, 6 insertions, 3 deletions
diff --git a/Completion/User/_man b/Completion/User/_man
index 68ec12679..2dae425ee 100644
--- a/Completion/User/_man
+++ b/Completion/User/_man
@@ -30,13 +30,16 @@ fi
 mrd=(${^manpath/\%L/${LANG:-En_US.ASCII}}/mandb(N))
 if [[ $words[2] = (<->*|1M|l|n) ]]; then
   rep=(
-  $manpath/(sman|man|cat)${words[2]}/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t) )
+  $manpath/(sman|man|cat)${words[2]}/${~approx}$PREFIX${~star}$SUFFIX.*(N:t) )
   (($#mrd)) && rep[$#rep+1]=($(awk "\$2 == \"$words[2]\" {print \$1}" $mrd))
 else
-  rep=( $manpath/(sman|man|cat)*/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t) )
+  rep=( $manpath/(sman|man|cat)*/${~approx}$PREFIX${~star}$SUFFIX.*(N:t) )
   (($#mrd)) && rep[$#rep+1]=($(awk '{print $1}' $mrd))
 fi
 
 
+# Remove any compression suffix, then remove the minimum possible string
+# beginning with .<->: that handles problem cases like files called
+# `POSIX.1.5'.
 (( $#rep )) && _wanted manuals expl 'manual page' \
-    compadd - ${rep%%.[^.]##(.gz|.bz2|)}
+    compadd - ${${rep%%.(bz2|z|gz|Z)}%.<->*}