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

Re: PATCH: Further improvements to _mailboxes



Bart Schaefer wrote:

> I'm still mysteriously getting a blank entry as the first item in a listing.
> This *seems* to be coming from _multi_parts, as when I menu-complete the
> first choice offered is `/' which doesn't appear in the listing anywhere.

I think I found it now... the test if the string to add contained a
separator character was too simple.

Bye
 Sven

diff -ru ../z.old/Completion/Core/_multi_parts Completion/Core/_multi_parts
--- ../z.old/Completion/Core/_multi_parts	Wed Mar  1 11:38:13 2000
+++ Completion/Core/_multi_parts	Wed Mar  1 13:03:21 2000
@@ -162,14 +162,27 @@
 	  tmp2=()
         fi
         for i in "${(@M)matches:#(${(j:|:)~tmp1})*}"; do
-	  if [[ "$i" = *${sep}* ]]; then
+	  case "$i" in
+	  *${sep})
+            compadd "$group[@]" "$expl[@]" -r "$sep" -S "$sep" "$opts[@]" \
+	            -p "$pref" \
+                    -M "r:|${sep}=* r:|=* $match" - "${i%%${sep}*}" && ret=0
+            ;;
+	  ${sep}*)
+            compadd "$group[@]" "$expl[@]" -S '' "$opts[@]" \
+	            -p "$pref" \
+                    -M "r:|${sep}=* r:|=* $match" - "$sep" && ret=0
+            ;;
+	  *${sep}*)
             compadd "$group[@]" "$expl[@]" -r "$sep" -S "$sep" "$opts[@]" \
 	            -p "$pref" \
                     -M "r:|${sep}=* r:|=* $match" - "${i%%${sep}*}" && ret=0
-          else
+            ;;
+          *)
             compadd "$group[@]" "$expl[@]" -S '' "$opts[@]" -p "$pref" \
                     -M "r:|${sep}=* r:|=* $match" - "$i" && ret=0
-          fi
+            ;;
+          esac
         done
       else
         # With normal completion we add all matches one-by-one with
@@ -178,7 +191,7 @@
 
         for i in "${(@M)matches:#(${(j:|:)~tmp1})*}"; do
 	  if [[ "$i" = *${sep}* ]]; then
-            compadd "$group[@]" "$expl[@]" -r "$sep" -S "$sep" "$opts[@]" \
+            compadd "$group[@]" "$expl[@]" "$opts[@]" \
 	            -p "$pref" -s "${i#*${sep}}" \
                     -M "r:|${sep}=* r:|=* $match" - "${i%%${sep}*}" && ret=0
           else

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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