about summary refs log tree commit diff
path: root/Completion/User/_netscape
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/User/_netscape')
-rw-r--r--Completion/User/_netscape71
1 files changed, 45 insertions, 26 deletions
diff --git a/Completion/User/_netscape b/Completion/User/_netscape
index 11f583dd5..3caaad05e 100644
--- a/Completion/User/_netscape
+++ b/Completion/User/_netscape
@@ -1,6 +1,6 @@
 #compdef netscape
 
-local state line
+local context state line ret=1
 typeset -A opt_args
 
 _x_arguments \
@@ -22,56 +22,75 @@ _x_arguments \
   -{,no-}{,irix-}session-management \
   -{done-save,ignore}-geometry-prefs \
   -{component-bar,composer,edit,messenger,mail,discussions,news} \
-  '*:location:->urls'
+  '*:location:->urls' && ret=0
+
+[[ "$state" = "urls" ]] &&
+  _tags "$context" files && _files "$@" && return 0
 
-[ "$state" = "urls" ] && _files "$@" && return
 
 # Handle netscape remote commands
-if [ "$state" = "remote" ]; then  
+if [[ "$state" = "remote" ]]; then  
   local -a remote_commands
   remote_commands=(openURL openFile saveAs mailto addBookmark)
 
   [[ $compstate[quoting] = (double|single) ]] && compset -q
   compset -P '*\('
   case $IPREFIX in
-    openURL*|addBookmark* ) state=urls;;
-    openFile* ) _files -W ~;;
-    saveAs* ) 
+    openURL*|addBookmark*) state=urls;;
+    openFile*) _files -W ~;;
+    saveAs*) 
       if compset -P "*,"; then
-        compadd -s")" -M 'm:{a-zA-Z}={A-Za-z}' HTML Text PostScript
+        if _tags "$context" types; then
+          _description expl 'data type'
+          compadd -s")" -M 'm:{a-zA-Z}={A-Za-z}' HTML Text PostScript &&
+              ret=0
+        fi
       else
-        _path_files -W ~
+        _tags "$context" files && _path_files -W ~ && ret=0
       fi
     ;;
-    mailto* )
+    mailto*)
       compset -P "*,"
       if compset -P '*@'; then
-        _description expl 'remote host name'
-        _hosts "$expl[@]" -q -S,
+        if _tags "$context" hosts; then
+          _description expl 'remote host name'
+          _hosts "$expl[@]" -q -S, && ret=0
+        fi
       else
-        _description expl 'login name'
-        _users "$expl[@]" -q -S@
+        if _tags "$context" users; then
+          _description expl 'login name'
+          _users "$expl[@]" -q -S@ && ret=0
+        fi
       fi
     ;;
-    * )
-      if [ "$QIPREFIX" ]; then
-        compadd -q -S '(' -M 'm:{a-zA-Z}={A-Za-z}' $remote_commands
-      else
-	compadd -s'(' -S '' -M 'm:{a-zA-Z}={A-Za-z}' $remote_commands
+    *)
+      if _tags "$context" commands; then
+        if [[ "$QIPREFIX" ]]; then
+          compadd -q -S '(' -M 'm:{a-zA-Z}={A-Za-z}' $remote_commands && ret=0
+        else
+	  compadd -s'(' -S '' -M 'm:{a-zA-Z}={A-Za-z}' $remote_commands && ret=0
+	fi
       fi
     ;;
   esac
 fi
 
-if [ "$state" = "urls" ]; then
+if [[ "$state" = "urls" ]]; then
   # Complete netscape urls
   if [[ -prefix about: ]]; then
-    compset -P about:
-    compadd authors blank cache document fonts global hype image-cache \
-        license logo memory-cache mozilla plugins
+    if _tags "$context" values; then
+      _description expl 'about what'
+      compset -P about:
+      compadd authors blank cache document fonts global hype image-cache \
+          license logo memory-cache mozilla plugins && ret=0
+    fi
   else
-    _description expl 'URL prefix'
-    compadd "$expl[@]" -S '' about: mocha: javascript:
-    _urls "$@"
+    if _tags "$context" prefixes; then
+      _description expl 'URL prefix'
+      compadd "$expl[@]" -S '' about: mocha: javascript:
+      _urls "$@" && ret=0
+    fi
   fi
 fi
+
+return ret