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

Re: PATCH: Re: PATCH: Improved _mailboxes



Bart Schaefer wrote:

> ...
> 
> There's one oddment left:  When completing the full paths added by
> _multi_parts under menu completion, one gets things like
> 
> 	zsh% mutt -f /<TAB>
> 	/home  /usr  /var
> 	zsh% mutt -f /<TAB>
> 	zsh% mutt -f /home/
> 
> Now hitting TAB just cycles /home /usr /var.  But if I type a / to continue
> completing within /home, I get
> 
> 	zsh% mutt -f /home//
> 
> I tried adding -S/ -q to the _multi_parts call but the slash still does not
> become autoremovable.  It does vanish when I next type TAB:
> 
> 	zsh% mutt -f /home//<TAB>
> 	zsh% mutt -f /home/schaefer/
> 
> This is with Sven's latest _multi_parts patch (9816).

I was worried about that, too.

This makes the separator character be removed if it is typed. Not that 
I used -r "$sep" so that typing a space or any other of those
characters that normally auto-remove such a suffix will in this case
*not* remove it. Since _multi_parts has to consider the strings it
gets to be exact matches, this is correct. If anyone doesn't like it,
tell me or just replace those `-r "$sep"''s with a -q, I'm not
religiously attached to them.

Bye
 Sven

diff -ru ../z.old/Completion/Core/_multi_parts Completion/Core/_multi_parts
--- ../z.old/Completion/Core/_multi_parts	Tue Feb 22 09:10:49 2000
+++ Completion/Core/_multi_parts	Tue Feb 22 10:06:31 2000
@@ -121,7 +121,7 @@
 	  tmp2=( "${(@M)matches:#${tmp1[1]}${sep}*}" )
 
 	  if (( $#tmp2 )); then
-	    compadd "$group[@]" "$expl[@]" -p "$pref" -qS "$sep" "$opts[@]" \
+	    compadd "$group[@]" "$expl[@]" -p "$pref" -r "$sep" -S "$sep" "$opts[@]" \
                     -M "r:|${sep}=* r:|=* $match" - "$tmp1[1]"
           else
 	    compadd "$group[@]" "$expl[@]" -p "$pref" "$sopts[@]" \
@@ -162,9 +162,9 @@
         fi
         for i in "${(@M)matches:#(${(j:|:)~tmp1})*}"; do
 	  if [[ "$i" = *${sep}* ]]; then
-            compadd "$group[@]" "$expl[@]" -S '' "$opts[@]" \
+            compadd "$group[@]" "$expl[@]" -r "$sep" -S "$sep" "$opts[@]" \
 	            -p "$pref" \
-                    -M "r:|${sep}=* r:|=* $match" - "${i%%${sep}*}${sep}"
+                    -M "r:|${sep}=* r:|=* $match" - "${i%%${sep}*}"
           else
             compadd "$group[@]" "$expl[@]" -S '' "$opts[@]" -p "$pref" \
                     -M "r:|${sep}=* r:|=* $match" - "$i"
@@ -177,9 +177,9 @@
 
         for i in "${(@M)matches:#(${(j:|:)~tmp1})*}"; do
 	  if [[ "$i" = *${sep}* ]]; then
-            compadd "$group[@]" "$expl[@]" -S '' "$opts[@]" \
+            compadd "$group[@]" "$expl[@]" -r "$sep" -S "$sep" "$opts[@]" \
 	            -p "$pref" -s "${i#*${sep}}" \
-                    -M "r:|${sep}=* r:|=* $match" - "${i%%${sep}*}${sep}"
+                    -M "r:|${sep}=* r:|=* $match" - "${i%%${sep}*}"
           else
             compadd "$group[@]" "$expl[@]" -S '' "$opts[@]" -p "$pref" \
                     -M "r:|${sep}=* r:|=* $match" - "$i"

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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