man: Don't expand man page extensions too early.

Breaks for example subdir completions if there is a subdir whose name
matches extensions in the current dir.
This commit is contained in:
Ville Skyttä 2012-12-28 18:37:42 +02:00
parent 08203f7743
commit 49ea121e5d
3 changed files with 7 additions and 3 deletions

View File

@ -18,7 +18,7 @@ _man()
return
;;
-l|--local-file)
_filedir $manext
_filedir "$manext"
return
;;
-M|--manpath)
@ -52,7 +52,7 @@ _man()
# file based completion if parameter looks like a path
if [[ "$cur" == @(*/|[.~])* ]]; then
_filedir $manext
_filedir "$manext"
return 0
fi
@ -91,7 +91,7 @@ _man()
# File based completion for the rest, prepending ./ if needed
# (man 1.6f needs that for man pages in current dir)
local i start=${#COMPREPLY[@]}
_filedir $manext
_filedir "$manext"
for (( i=$start; i < ${#COMPREPLY[@]}; i++ )); do
[[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]}
done

0
test/fixtures/man/man/quux.8 vendored Normal file
View File

View File

@ -30,4 +30,8 @@ assert_complete "Bash::Completion" "man Bash::C"
sync_after_int
assert_complete_dir "man/quux.8" "man man/" $::srcdir/fixtures/man
sync_after_int
teardown