zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-user <zsh-users@zsh.org>
Subject: Re: append mark qualifier disturbs sort qualifier?
Date: Wed, 24 Sep 2014 19:27:57 +0100	[thread overview]
Message-ID: <20140924192757.051379ea@pws-pc.ntlworld.com> (raw)
In-Reply-To: <20140924092404.GB3248@localhost.localdomain>

On Wed, 24 Sep 2014 17:24:04 +0800
Han Pingtian <hanpt@linux.vnet.ibm.com> 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@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


  parent reply	other threads:[~2014-09-24 20:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24  9:24 Han Pingtian
2014-09-24  9:49 ` Peter Stephenson
2014-09-24 16:30   ` Bart Schaefer
2014-09-24 18:27 ` Peter Stephenson [this message]
2014-09-25  2:32   ` Han Pingtian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140924192757.051379ea@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).