about summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-01-14 15:34:57 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-01-18 02:40:01 +0000
commit35b8e8794f00987b4b9380f5f20f6ca6ec64b7c3 (patch)
tree6a38f19236614761bec2e8330a1002abe1b2b930 /Completion/Unix/Command
parentc380c9394a3263d1e7c5b6f688dfd1b305b3600e (diff)
downloadzsh-35b8e8794f00987b4b9380f5f20f6ca6ec64b7c3.tar.gz
zsh-35b8e8794f00987b4b9380f5f20f6ca6ec64b7c3.tar.xz
zsh-35b8e8794f00987b4b9380f5f20f6ca6ec64b7c3.zip
37634: _man: Disentangle a local variable that had two distinct semantics. No functional change
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_man19
1 files changed, 11 insertions, 8 deletions
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index 81ac40bc2..871af4854 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -37,7 +37,10 @@ _man() {
 
   mrd=(${^_manpath/\%L/${LANG:-En_US.ASCII}}/mandb(N))
 
-  local sect
+  # $sect is from the command line, the "3p" in "man 3p memcpy"
+  # $sect_dirname is from the filesystem, the "3" in "/usr/share/man/man3"
+  # These are used by _man_pages
+  local sect sect_dirname
   if [[ $OSTYPE = solaris* ]]; then
     sect=${${words[(R)-s*]#-s}:-$words[$words[(i)-s]+1]}
   elif [[ -n ${sect:=$words[$words[(i)-S]+1]} || -n ${sect:=$MANSECT} ]]; then
@@ -69,8 +72,8 @@ _man() {
 
     _tags manuals.${^sects}
     while _tags; do
-      for sect in $sects; do
-        _requested manuals.$sect expl "manual page, section $sect" _man_pages &&
+      for sect_dirname in $sects; do
+        _requested manuals.$sect_dirname expl "manual page, section $sect_dirname" _man_pages &&
             ret=0
       done
       (( ret )) || return 0
@@ -78,7 +81,7 @@ _man() {
 
     return 1
   else
-    sect=
+    sect_dirname=
     _wanted manuals expl 'manual page' _man_pages
   fi
 }
@@ -107,8 +110,8 @@ _man_pages() {
     matcher=
   fi
 
-  pages=( ${(M)dirs:#*$sect/} )
-  compfiles -p pages '' '' "$matcher" '' dummy '*'
+  pages=( ${(M)dirs:#*$sect_dirname/} )
+  compfiles -p pages '' '' "$matcher" '' dummy "*"
   pages=( ${^~pages}(N:t) )
 
   (($#mrd)) && pages[$#pages+1]=($(awk $awk $mrd))
@@ -119,11 +122,11 @@ _man_pages() {
 
   [[ $OSTYPE = solaris* ]] && sopt='-s '
   if ((CURRENT > 2)) ||
-      ! zstyle -t ":completion:${curcontext}:manuals.$sect" insert-sections
+      ! zstyle -t ":completion:${curcontext}:manuals.$sect_dirname" insert-sections
   then
     compadd "$@" - ${pages%$~suf}
   else
-    compadd "$@" -P "$sopt$sect " - ${pages%$~suf}
+    compadd "$@" -P "$sopt$sect_dirname " - ${pages%$~suf}
   fi
 }