diff options
author | Oliver Kiddle <opk@users.sourceforge.net> | 2000-05-23 16:11:57 +0000 |
---|---|---|
committer | Oliver Kiddle <opk@users.sourceforge.net> | 2000-05-23 16:11:57 +0000 |
commit | 0735f0d8890133b903ac84e036674598f14ed20e (patch) | |
tree | 60bf7b7e7a2f75c112468c1b3954ef4789318b53 /Completion/User/_urls | |
parent | bfe6602d9ed26e3138f7612b1959b85fec833507 (diff) | |
download | zsh-0735f0d8890133b903ac84e036674598f14ed20e.tar.gz zsh-0735f0d8890133b903ac84e036674598f14ed20e.tar.xz zsh-0735f0d8890133b903ac84e036674598f14ed20e.zip |
Suffix handling improvements for url completion (11539)
Diffstat (limited to 'Completion/User/_urls')
-rw-r--r-- | Completion/User/_urls | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/Completion/User/_urls b/Completion/User/_urls index 324a2bdb3..7fa120d2c 100644 --- a/Completion/User/_urls +++ b/Completion/User/_urls @@ -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 |