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

Re: PATCH: Completion/Cvs/



Tanaka Akira wrote:

> is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
> is27e1u11% compconf group_matches=yes
> is27e1u11% compconf message_format='%d'
> is27e1u11% compconf description_format='%d'
> is27e1u11% _tst () { _arguments '-e+:editor:(vi)' '*::mesg:false' }   
> is27e1u11% tst -e<TAB>
> 
> This should complete `vi', but does not.
> 
> is27e1u11% cvs <TAB>
> add        commit     export     log        release    tag        watchers
> admin      diff       history    login      remove     unedit     
> annotate   edit       import     logout     rtag       update     
> checkout   editors    init       rdiff      status     watch      
> 
> Also, this should complete cvs common options addition to cvs commands.

Damn, I'm getting a bit confused...

> Reverting the hunk fix this problem. Is this correct?

No, that would make `tst a -e<TAB>' complete to `vi' again. The patch
below adds a flag that says if we left the command line parsing
because we found a non-option and we have `*::..'. Whew, I hope this
gets everything right this time ;-)

Bye
 Sven

diff -u oc/Base/_arguments Completion/Base/_arguments
--- oc/Base/_arguments	Wed Sep  1 13:04:49 1999
+++ Completion/Base/_arguments	Wed Sep  1 14:19:38 1999
@@ -7,7 +7,7 @@
 
 local args rest ws cur nth def nm expl descr action opt arg tmp
 local single uns ret=1 soptseq soptseq1 sopts prefix line
-local beg optbeg argbeg nargbeg inopt fromrest
+local beg optbeg argbeg nargbeg inopt inrest fromrest
 
 # Associative arrays used to collect information about the options.
 
@@ -500,7 +500,10 @@
 	line=( "$line[@]" "$ws[1]" )
 	[[ -n "$inopt" ]] && nargbeg=$(( beg - 1 ))
 	inopt=''
-        [[ -z "$args[nth]" && "$rest" = \*::* ]] && break
+        if [[ -z "$args[nth]" && "$rest" = \*::* ]]; then
+	  inrest=yes
+	  break
+        fi
 	(( nth++ ))
       fi
     fi
@@ -537,7 +540,7 @@
       optbeg="$nargbeg"
       argbeg="$nargbeg"
       fromrest=yes
-      [[ "$def" = \*::* ]] && opt=''
+      [[ -n "$inrest" ]] && opt=''
     fi
   fi
 

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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