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

Re: PATCH: Re: CVS completer (Re: PATCH: Re: Completion/User functions again)



In article <990727074804.ZM25420@xxxxxxxxxxxxxxxxxxxxxxx>,
  "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx> writes:

> zsh% cvs add <C-d>
> F#bar F#baz
> zsh% cvs add <TAB>
> zsh% cvs add F\#<TAB>
> (BEEP)
> zsh% cvs add F\#<C-d>
> (BEEP)
> zsh% cvs add F\#<C-b><DEL><C-e>
> zsh% cvs add F#<C-d>
> F#bar F#baz
> zsh% cvs add F#<TAB>
> zsh% cvs add F\#

I tried to fix this problem by using compgen -g instead of compadd for
_cvsaddp, _cvstargets and _cvstargets_modified.

Although _cvsremovep has same problem too, this fix is not applicable
because compgen -g does not generate nonexisting filenames.

Any ideas?

--- Completion/User/_cvs	Tue Jul 27 18:16:28 1999
+++ /home/fs114/akr/arch/sunos5/usr/local/share/zsh/functions/_cvs	Tue Jul 27 19:01:03 1999
@@ -182,22 +182,14 @@
 }
 
 _cvsprefix () {
-  local f
-  qpref=$PREFIX
-  if [[ $qpref != */ ]]; then
-    if [[ $qpref = */* ]]; then
-      qpref=$qpref:h
-    else
-      qpref=
-    fi
-  fi
-  pref=$~qpref
-  if [[ ! -d "$pref" ]]; then
+  #if [[ -prefix */ ]]; then
+  if [[ x"$PREFIX" == x*/* ]]; then
+    qpref="${PREFIX%/*}/"
+    pref=$~qpref
+  else
     qpref=
-    pref=
+    pref=./
   fi
-  [[ -n "$pref" && "$pref" != */ ]] && qpref=$qpref/ pref=$pref/
-  [[ -z "$pref" ]] && pref=./
 }
 
 _cvsdirentries () {
@@ -248,56 +240,54 @@
 }
 
 _cvsdirs () {
-  local qpref pref entries
-  _cvsprefix
   if [[ -d ${pref}CVS ]]; then
     _cvsdirentries
-    compadd -fP "$qpref" -W "$pref" - $entries
+    compadd -fW "$pref" - $entries
   else
-    _files
+    _files -W "$pref"
   fi
 }
 
 _cvstargets () {
   local qpref pref entries
-  _cvsprefix
+  _cvsprefix; compset -P '*/'
   if [[ -d ${pref}CVS ]]; then
     _cvsentries
-    compadd -fP "$qpref" -W "$pref" - $entries
+    compgen -W "$pref" -g "(${(j:|:)entries})"
   else
-    _files
+    _files -W "$pref"
   fi
 }
 
 _cvstargets_modified () {
   local qpref pref entries
-  _cvsprefix
+  _cvsprefix; compset -P '*/'
   if [[ -d ${pref}CVS ]]; then
     _cvsentries_modified
-    compadd -fP "$qpref" -W "$pref" - $entries
+    compgen -W "$pref" -g "(${(j:|:)entries})"
   else
-    _files
+    _files -W "$pref"
   fi
 }
 
 _cvsremovep () {
   local qpref pref entries
-  _cvsprefix
+  _cvsprefix; compset -P '*/'
   if [[ -d ${pref}CVS ]]; then
     _cvsentries
     setopt localoptions unset
     local omit
     omit=( ${pref}*(D:t) )
-    eval 'compadd -fP "$qpref" -W "$pref" - ${entries:#('${(j:|:)omit}')}' ||
+    eval 'compadd -fW "$pref" - ${entries:#('${(j:|:)omit}')}' ||
     _cvsdirs
   else
-    _files
+    _files -W "$pref"
   fi
 }
 
 _cvsaddp () {
   local qpref pref entries
-  _cvsprefix
+  _cvsprefix; compset -P '*/'
   if [[ -d ${pref}CVS ]]; then
     _cvsentries
     setopt localoptions unset
@@ -306,10 +296,10 @@
     omit=( CVS $entries ${=cvsignore} )
     [[ -r ~/.cvsignore ]] && omit=( $omit $(<~/.cvsignore) )
     [[ -r ${pref}.cvsignore ]] && omit=( $omit $(<${pref}.cvsignore) )
-    compgen -P "$qpref" -W "$pref" -g "*~*/(${(j:|:)omit})" ||
+    compgen -W "$pref" -g "*~*/(${(j:|:)omit})" ||
     _cvsdirs
   else
-    _files
+    _files -W "$pref"
   fi
 }
 
-- 
Tanaka Akira



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