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

PATCH: overeager use of stat list format



This must have been there for ages, though I've only just noticed by
trying to complete in my zsh functions directory which contains lots and
lots and lots of files.

I have the file-list style set to list=10 which means display as ls -l
if I'm listing and I have no more than 10 files to list.

It turns out owing to a typo in the pattern it can match if I'm not
listing and I have any number of files at all.  So normal completion
with TAB just hung up for ages and as it didn't display the listing
there was no obvious reason.

The moral is the usual one: be careful about designing patterns that
aren't supposed to match a certain type of string.

I'm worried I'm only seeing this because something else just got a lot
more inefficient, but I'm not going to be looking at that myself.
(Alternatively, I may have fixed some obscure pattern bug with a
knock-on effect.)

pws

diff --git a/Completion/Unix/Type/_list_files b/Completion/Unix/Type/_list_files
index e04392d..6c52bc1 100644
--- a/Completion/Unix/Type/_list_files
+++ b/Completion/Unix/Type/_list_files
@@ -36,7 +36,7 @@ for elt in $stylevals; do
     break
     ;;
 
-    (*($what|all|true|1|yes)[^=]#)
+    ([^=]#($what|all|true|1|yes)[^=]#)
     # always use long format
     (( ok = 1 ))
     break



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