From 0735f0d8890133b903ac84e036674598f14ed20e Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Tue, 23 May 2000 16:11:57 +0000 Subject: Suffix handling improvements for url completion (11539) --- ChangeLog | 5 +++++ Completion/User/_netscape | 6 +++--- Completion/User/_urls | 28 +++++++++++++++------------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa222bf0d..f6aa54a9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-05-23 Oliver Kiddle + + * 11539: Completion/User/_netscape, Completion/User/_urls: further + suffix handling improvements + 2000-05-23 Peter Stephenson * 11537: Completion/Command/_complete_tag, diff --git a/Completion/User/_netscape b/Completion/User/_netscape index fda41cd35..c6fd084cc 100644 --- a/Completion/User/_netscape +++ b/Completion/User/_netscape @@ -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 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 -- cgit 1.4.1