Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: man completion breaks after upgrade from 5.2 to 5.3



Benoit Izac wrote on Tue, Jan 03, 2017 at 14:53:02 +0100:
> I have a problem with man completion since I upgraded 5.2 to 5.3,
> man -a <TAB> returns only a few possibilities (about 50) when man <TAB>
> returns about 23300 possibilities.
> 
> I'm not comfortable with the zsh syntax used in completion, could
> someone help me to find where it breaks?

Bisected to:

896f43c72bcfd3f1e2240f54609868634a3c4e45 is the first bad commit
commit 896f43c72bcfd3f1e2240f54609868634a3c4e45
Author: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
Date:   Thu Jan 14 15:37:43 2016 +0000

    37634: _man: Support subsection names such as '3p'.

Probably due to the "*${sect}*" change in there.  This does the trick:

diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index b2aaeaf..67810e1 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -51,7 +51,11 @@ _man() {
     sect="${sect//:/|}"
     sect="${sect//,/|}"
   elif (( CURRENT > 2 )); then
-    sect=$words[2]
+    case $words[2] in
+      (-a) sect='*';;
+      (-*) ;;
+      (*)  sect=$words[2];;
+    esac
   fi
 
   if [[ $sect = (<->*|1M|l|n) || $sect = *\|* ]]; then

-a means 'all sections' on Linux and FreeBSD, and this elif branch isn't used
on Solaris.  Does any other system have a conflicting/different meaning of -a?

Cheers,

Daniel
(Thanks for the parallel IRC report, it was much faster to iterate that way)



Messages sorted by: Reverse Date, Date, Thread, Author