Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 2/3] _man: Fix two bugs when completing manpage filenames in separate-sections mode.
- X-seq: zsh-workers 38994
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 2/3] _man: Fix two bugs when completing manpage filenames in separate-sections mode.
- Date: Thu, 4 Aug 2016 15:54:24 +0000
- In-reply-to: <1470326066-3241-1-git-send-email-danielsh@tarsus.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1470326066-3241-1-git-send-email-danielsh@tarsus.local2>
- No longer glob all files (the (-g)-less _path_files was virtually always called,
by at least one of the multiple calls to _man_pages).
- Actually separate sections (by propagating $expl).
---
Completion/Unix/Command/_man | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index ef17ad8..ffe53be 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -87,6 +87,13 @@ _man() {
done
(( ret )) || return 0
done
+ ## To fall back to other sections' manpages when completing filenames, like
+ ## the 'else' codepath does:
+ #
+ # if (( ret )) && [[ $PREFIX$SUFFIX == */* ]]; then
+ # sect_dirname=
+ # _wanted manuals expl 'manual page' _man_pages && return
+ # fi
return 1
else
@@ -105,9 +112,13 @@ _man_pages() {
# Easy way to test for versions of man that allow file names.
# This can't be a normal man page reference.
# Try to complete by glob first.
- _path_files -g "*$suf" && return
- _path_files
- return
+ if [[ -n $sect_dirname ]]; then
+ _path_files -g "*.*$sect_dirname*(|.gz|.bz2|.Z|.lzma)" "$expl[@]"
+ else
+ _path_files -g "*$suf" "$expl[@]" && return
+ _path_files "$expl[@]"
+ fi
+ return $?
fi
zparseopts -E M+:=matcher
Messages sorted by:
Reverse Date,
Date,
Thread,
Author