Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completion in 3.1.9



On Jul 21, 10:36am, Chmouel Boudjnah wrote:
} Subject: completion in 3.1.9
}
} In pristine 3.1.9 the completion has the problem i have reported a
} while ago and it was corrected in the cvs tree. [...]
} would be possible to have a backward patches, i can't find it in the
} archives of the ml.

It was article 12225, which can be discovered by searching for _rpm in
the ChangeLog file.

It's easy to generate patches against known past revisions with cvs.
What I don't know for sure is whether any of the following depends on
any of the other changes to Zle/*.c in order to work properly.

zagzig[200] cvs -z3 diff -rzsh-3_1_9 -u Completion/Linux/_rpm
Index: Completion/Linux/_rpm
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/_rpm,v
retrieving revision 1.13
retrieving revision 1.15
diff -u -r1.13 -r1.15
--- Completion/Linux/_rpm	2000/06/05 02:23:53	1.13
+++ Completion/Linux/_rpm	2000/07/12 09:01:41	1.15
@@ -41,7 +41,7 @@
 
 # Used by `_arguments', made local here.
 
-local curcontext="$curcontext" state lstate line
+local curcontext="$curcontext" state lstate line nm="$compstate[nmatches]"
 typeset -A opt_args
 
 state=''
@@ -211,12 +211,14 @@
         _files -g \*.spec && ret=0
     ;;
   package_file)
-    if compset -P '(f|ht)tp://'; then
-      _hosts -S/ && ret=0
+    _wanted files expl 'RPM package file' \
+        _files -g '*.(#i)rpm' && ret=0
+    if [[ -prefix 1 (f|ht)tp:// ]]; then
+      _wanted urls expl 'URL of RPM package file' \
+          _urls -f -g '*.(#i)rpm' "${expl[@]}" && ret=0
     else
-      _alternative \
-          'files:RPM package file:_files -g \*.\(\#i\)rpm' \
-          'prefixes:URL prefix:compadd ftp:// http://' && ret=0
+      _wanted urls expl 'URL of RPM package file' \
+          compadd -S '' "${expl[@]}" ftp:// http:// && ret=0
     fi
     ;;
   package_src)
@@ -244,6 +246,8 @@
     _files "$expl[@]" -/ && ret=0
     ;;
   esac
+
+  [[ ret -eq 0 || $nm -ne $compstate[nmatches] ]] && return 0
 done
 
 return ret

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author