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

Suffix handling improvements for url completion (11539)

This commit is contained in:
Oliver Kiddle 2000-05-23 16:11:57 +00:00
parent bfe6602d9e
commit 0735f0d889
3 changed files with 23 additions and 16 deletions

View file

@ -1,3 +1,8 @@
2000-05-23 Oliver Kiddle <opk@zsh.org>
* 11539: Completion/User/_netscape, Completion/User/_urls: further
suffix handling improvements
2000-05-23 Peter Stephenson <pws@cambridgesiliconradio.com>
* 11537: Completion/Command/_complete_tag,

View file

@ -77,10 +77,10 @@ if [[ "$state" = "urls" ]]; then
else
_tags prefixes
while _tags; do
while _next_label prefixes expl 'URL prefix'; do
_urls "$@" && ret=0
while _next_label prefixes expl 'URL prefix' "$@"; do
_urls "$expl[@]" && ret=0
compset -S '[^:]*'
compadd "$expl[@]" -S '' about: mocha: javascript: && ret=0
compadd -S '' "$expl[@]" about: mocha: javascript: && ret=0
done
(( ret )) || return 0
done

View file

@ -57,10 +57,11 @@ ipre="$IPREFIX"
if ! compset -P '(#b)([-+.a-z0-9]#):'; then
_tags -C argument prefixes
while _tags; do
while _next_label prefixes expl 'URL prefix'; do
while _next_label prefixes expl 'URL prefix' -S '' "$@"; do
compset -S '[^:/]*' && compstate[to_end]=''
[[ -d $urls_path/bookmark ]] &&
compadd "$expl[@]" -S '' bookmark: && ret=0
compadd "$expl[@]" -S '' file: ftp:// gopher:// http:// && ret=0
compadd "$expl[@]" bookmark: && ret=0
compadd "$expl[@]" file: ftp:// gopher:// http:// && ret=0
done
(( ret )) || return 0
done
@ -71,7 +72,7 @@ scheme="$match[1]"
case "$scheme" in
http|ftp|gopher)
if ! compset -P //; then
_wanted -C "$scheme" prefixes expl 'end of prefix' compadd "$@" -S '' //
_wanted -C "$scheme" prefixes expl 'end of prefix' compadd -S '' "$@" //
return
fi
;;
@ -84,7 +85,7 @@ case "$scheme" in
_path_files "$expl[@]" -S '' -g '*(^/)' && ret=0
_path_files "$expl[@]" -S/ -r '/' -/ && ret=0
elif [[ -z "$PREFIX" ]]; then
compadd "$expl[@]" -S '/' -r '/' - "${PWD%/}" && ret=0
compadd -S '/' -r '/' "$expl[@]" "$@" - "${PWD%/}" && ret=0
fi
done
(( ret )) || return 0
@ -104,7 +105,7 @@ case "$scheme" in
while _next_label files expl 'bookmark'; do
_path_files -W "$urls_path/$scheme" "$expl[@]" -S '' -g '*(^/)' &&
ret=0
_path_files -W "$urls_path/$scheme" "$expl[@]" -S/ -r '/' -/ && ret=0
_path_files -W "$urls_path/$scheme" -S/ -r '/' "$expl[@]" -/ && ret=0
done
(( ret )) || return 0
done
@ -119,10 +120,11 @@ if ! compset -P '(#b)([^/]#)/'; then
_tags hosts
while _tags; do
while _next_label hosts expl host; do
(( $#uhosts )) || _hosts -S/ && ret=0
while _next_label hosts expl host "$@"; do
compset -S '/*' || suf="/"
(( $#uhosts )) || _hosts -S "$suf" "$expl[@]" && ret=0
[[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername)
compadd "$expl[@]" -S/ - $uhosts && ret=0
compadd -S "$suf" "$expl[@]" - $uhosts && ret=0
done
(( ret )) || return 0
done
@ -137,14 +139,14 @@ _tags -C local files || return 1
if [[ "$localhttp_servername" = "$host" ]]; then
if compset -P \~; then
if ! compset -P '(#b)([^/]#)/'; then
_users -S/
_users -S/ "$@"
return
fi
user="$match[1]"
while _tags; do
while _next_label files expl 'local file'; do
_path_files "$expl[@]" "$@" -W ~$user/$localhttp_userdir -g '*(^/)' && ret=0
_path_files "$expl[@]" -W ~$user/$localhttp_userdir -S/ -r '/' -/ && ret=0
_path_files -S/ -r '/' "$expl[@]" -W ~$user/$localhttp_userdir-/ && ret=0
done
(( ret )) || return 0
done
@ -152,7 +154,7 @@ if [[ "$localhttp_servername" = "$host" ]]; then
while _tags; do
while _next_label files expl 'local file'; do
_path_files "$expl[@]" "$@" -W $localhttp_documentroot -g '*(^/)' && ret=0
_path_files "$expl[@]" -W $localhttp_documentroot -S/ -r '/' -/ && ret=0
_path_files -S/ -r '/' "$expl[@]" -W $localhttp_documentroot -/ && ret=0
done
(( ret )) || return 0
done
@ -161,7 +163,7 @@ else
while _tags; do
while _next_label files expl 'local file'; do
_path_files "$expl[@]" "$@" -W $urls_path/$scheme/$host -g '*(^/)' && ret=0
_path_files "$expl[@]" -W $urls_path/$scheme/$host -S/ -r '/' -/ && ret=0
_path_files -S/ -r '/' "$expl[@]" -W $urls_path/$scheme/$host -/ && ret=0
done
(( ret )) || return 0
done