1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-04 10:41:11 +02:00

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

This commit is contained in:
Daniel Shahaf 2016-01-14 15:37:43 +00:00
parent 35b8e8794f
commit 896f43c72b
2 changed files with 5 additions and 2 deletions

View file

@ -1,5 +1,8 @@
2016-01-18 Daniel Shahaf <d.s@daniel.shahaf.name>
* 37634: Completion/Unix/Command/_man: _man: Support subsection
names such as '3p'.
* 37634: Completion/Unix/Command/_man: _man: Disentangle a local
variable that had two distinct semantics. No functional change

View file

@ -52,7 +52,7 @@ _man() {
fi
if [[ $sect = (<->*|1M|l|n) || $sect = \(*\|*\) ]]; then
dirs=( $^_manpath/(sman|man|cat)${~sect}/ )
dirs=( $^_manpath/(sman|man|cat)${~sect%%[^0-9]#}/ )
awk="\$2 == \"$sect\" {print \$1}"
else
dirs=( $^_manpath/(sman|man|cat)*/ )
@ -111,7 +111,7 @@ _man_pages() {
fi
pages=( ${(M)dirs:#*$sect_dirname/} )
compfiles -p pages '' '' "$matcher" '' dummy "*"
compfiles -p pages '' '' "$matcher" '' dummy "*${(b)sect}*"
pages=( ${^~pages}(N:t) )
(($#mrd)) && pages[$#pages+1]=($(awk $awk $mrd))