about summary refs log tree commit diff
path: root/Completion/User
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2000-05-19 18:44:21 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2000-05-19 18:44:21 +0000
commitf97eaa45796d232fe2e860eb83c1c523ee47a6cd (patch)
tree4b194cac24c5b2b8f06de15f5ea6d3e14abcb95e /Completion/User
parent2f6db0a72a1821b37acec203af2a2b67b63b1cd1 (diff)
downloadzsh-f97eaa45796d232fe2e860eb83c1c523ee47a6cd.tar.gz
zsh-f97eaa45796d232fe2e860eb83c1c523ee47a6cd.tar.xz
zsh-f97eaa45796d232fe2e860eb83c1c523ee47a6cd.zip
Do a better job of completing suffixes in netscape remote commands (11471)
Diffstat (limited to 'Completion/User')
-rw-r--r--Completion/User/_netscape28
-rw-r--r--Completion/User/_urls12
2 files changed, 23 insertions, 17 deletions
diff --git a/Completion/User/_netscape b/Completion/User/_netscape
index 33db18aee..fda41cd35 100644
--- a/Completion/User/_netscape
+++ b/Completion/User/_netscape
@@ -1,6 +1,6 @@
 #compdef netscape
 
-local curcontext="$curcontext" state line ret=1
+local curcontext="$curcontext" state line ret=1 suf
 typeset -A opt_args
 
 _x_arguments -C \
@@ -27,24 +27,27 @@ _x_arguments -C \
 [[ "$state" = "urls" ]] &&
   _files "$@" && return 0
 
-
 # Handle netscape remote commands
 if [[ "$state" = "remote" ]]; then  
   local -a remote_commands
   remote_commands=(openURL openFile saveAs mailto addBookmark)
 
-  [[ $compstate[quoting] = (double|single) ]] && compset -q
   compset -P '*\('
+  if compset -S '(|\\)\)*'; then
+    set - -S "" "$@"
+  else
+    set - -S"${${QIPREFIX:+)}:-\)}$compstate[quote] " "$@"
+  fi
   case $IPREFIX in
     openURL*|addBookmark*) state=urls;;
-    openFile*) _files -W ~;;
+    openFile*) _files "$@" -W ~;;
     saveAs*) 
       if compset -P "*,"; then
         _wanted types expl 'data type' \
-            compadd -s")" -M 'm:{a-zA-Z}={A-Za-z}' HTML Text PostScript &&
-                ret=0
+            compadd "$@" -M 'm:{a-zA-Z}={A-Za-z}' HTML Text PostScript && ret=0
       else
-        _files -W ~ && ret=0
+        compset -S ",*" || suf=","
+        _files -qS "$suf" -W ~ && ret=0
       fi
     ;;
     mailto*)
@@ -52,12 +55,14 @@ if [[ "$state" = "remote" ]]; then
       if compset -P '*@'; then
         _wanted hosts expl 'remote host name' _hosts -q -S, && ret=0
       else
-        _wanted users expl 'login name' _users -q -S@ && ret=0
+        compset -S "@*" || suf="@"
+        _wanted users expl 'login name' _users -q -S "$suf" && ret=0
       fi
     ;;
     *)
+      compset -S '(|\\)\(*' || suf="${${QIPREFIX:+(}:-\(}"
       _wanted commands expl 'remote commands' \
-  	  compadd -qS "${${QIPREFIX:+(}:-\(}" -M 'm:{a-zA-Z}={A-Za-z}' - \
+          compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' - \
                   $remote_commands && ret=0
     ;;
   esac
@@ -67,14 +72,15 @@ if [[ "$state" = "urls" ]]; then
   # Complete netscape urls
   if compset -P about: ; then
     _wanted values expl 'about what' \
-        compadd authors blank cache document fonts global hype image-cache \
+        compadd "$@" authors blank cache document fonts global hype image-cache \
             license logo memory-cache mozilla plugins && ret=0
   else
     _tags prefixes
     while _tags; do
       while _next_label prefixes expl 'URL prefix'; do
-        compadd "$expl[@]" -S '' about: mocha: javascript: && ret=0
         _urls "$@" && ret=0
+	compset -S '[^:]*'
+        compadd "$expl[@]" -S '' about: mocha: javascript: && ret=0
       done
       (( ret )) || return 0
     done
diff --git a/Completion/User/_urls b/Completion/User/_urls
index 691a386ec..324a2bdb3 100644
--- a/Completion/User/_urls
+++ b/Completion/User/_urls
@@ -57,7 +57,7 @@ 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'; do
       [[ -d $urls_path/bookmark ]] &&
         compadd "$expl[@]" -S '' bookmark: && ret=0
       compadd "$expl[@]" -S '' file: ftp:// gopher:// http:// && ret=0
@@ -79,7 +79,7 @@ case "$scheme" in
     if ! compset -P //; then
       _tags -C file files
       while _tags; do
-        while _next_label files expl 'local file' "$@"; do
+        while _next_label files expl 'local file'; do
           if [[ -prefix / ]]; then
 	    _path_files "$expl[@]" -S '' -g '*(^/)' && ret=0
 	    _path_files "$expl[@]" -S/ -r '/' -/ && ret=0
@@ -119,7 +119,7 @@ if ! compset -P '(#b)([^/]#)/'; then
 
   _tags hosts
   while _tags; do
-    while _next_label hosts expl host "$@"; do
+    while _next_label hosts expl host; do
       (( $#uhosts )) || _hosts -S/ && ret=0
       [[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername)
       compadd "$expl[@]" -S/ - $uhosts && ret=0
@@ -143,7 +143,7 @@ if [[ "$localhttp_servername" = "$host" ]]; then
     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 -g '*(^/)' && ret=0
         _path_files "$expl[@]" -W ~$user/$localhttp_userdir -S/ -r '/' -/ && ret=0
       done
       (( ret )) || return 0
@@ -151,7 +151,7 @@ if [[ "$localhttp_servername" = "$host" ]]; then
   else
     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 -g '*(^/)' && ret=0
         _path_files "$expl[@]" -W $localhttp_documentroot -S/ -r '/' -/ && ret=0
       done
       (( ret )) || return 0
@@ -160,7 +160,7 @@ if [[ "$localhttp_servername" = "$host" ]]; then
 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 -g '*(^/)' && ret=0
       _path_files "$expl[@]" -W $urls_path/$scheme/$host -S/ -r '/' -/ && ret=0
     done
     (( ret )) || return 0