1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-11 13:01:28 +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> 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 * 37634: Completion/Unix/Command/_man: _man: Disentangle a local
variable that had two distinct semantics. No functional change variable that had two distinct semantics. No functional change

View file

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