From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19774 invoked from network); 27 Oct 1999 08:28:17 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 27 Oct 1999 08:28:17 -0000 Received: (qmail 26489 invoked by alias); 27 Oct 1999 08:28:02 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8439 Received: (qmail 26482 invoked from network); 27 Oct 1999 08:28:01 -0000 Date: Wed, 27 Oct 1999 10:25:14 +0200 (MET DST) Message-Id: <199910270825.KAA15330@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk Subject: PATCH: suggestion for completion lists [I forgot to say... that last patch I sent may be offset, due to this one here.] I /think/ this was asked for before and personally I really like it: this makes completion lists obey the NUMERIC_GLOB_SORT option. I.e. if it is set matches with numbers in them are sorted in a better vgrepable way. Question is if this should use its own option and, if not, if we should document it. I guess we should, but where: at the option description or somewhere in the completion docs? Bye Sven diff -u oldsrc/Zle/zle_tricky.c Src/Zle/zle_tricky.c --- oldsrc/Zle/zle_tricky.c Tue Oct 26 20:35:44 1999 +++ Src/Zle/zle_tricky.c Tue Oct 26 20:43:44 1999 @@ -5529,11 +5529,33 @@ if (*b == '\\') b++; if (*a != *b) - return (int)(*a - *b); + break; if (*a) a++; if (*b) b++; + } + if (isset(NUMERICGLOBSORT) && (idigit(*a) || idigit(*b))) { + for (; a > *aa && idigit(a[-1]); a--, b--); + if (idigit(*a) && idigit(*b)) { + while (*a == '0') + a++; + while (*b == '0') + b++; + for (; idigit(*a) && *a == *b; a++, b++); + if (idigit(*a) || idigit(*b)) { + int cmp = (int) STOUC(*a) - (int) STOUC(*b); + + while (idigit(*a) && idigit(*b)) + a++, b++; + if (idigit(*a) && !idigit(*b)) + return 1; + if (idigit(*b) && !idigit(*a)) + return -1; + + return cmp; + } + } } return (int)(*a - *b); } -- Sven Wischnowsky wischnow@informatik.hu-berlin.de