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

Re: append mark qualifier disturbs sort qualifier?



On Wed, 24 Sep 2014 17:24:04 +0800
Han Pingtian <hanpt@xxxxxxxxxxxxxxxxxx> wrote:
> localhost% print -l **/*(odonT)
> 2/3/4/
> 2/3/4/5.txt 
> 2/3/4/6.txt 
> 2/
> 2/3/
> 
> Here, looks like "(T)" disturbs the sorting of "(odon)"?

Aha.

diff --git a/Src/glob.c b/Src/glob.c
index c24bfec..ca7bc44 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -900,6 +900,9 @@ gmatchcmp(Gmatch a, Gmatch b)
 		/* Count slashes.  Trailing slashes don't count. */
 		while (*aptr && *aptr == *bptr)
 		    aptr++, bptr++;
+		/* Like I just said... */
+		if ((!*aptr || !*bptr) && aptr > a->name && aptr[-1] == '/')
+		    aptr--, bptr--;
 		if (*aptr)
 		    for (; aptr[1]; aptr++)
 			if (*aptr == '/') {

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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