From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: suggestion for completion lists
Date: Wed, 27 Oct 1999 10:25:14 +0200 (MET DST) [thread overview]
Message-ID: <199910270825.KAA15330@beta.informatik.hu-berlin.de> (raw)
[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
reply other threads:[~1999-10-27 8:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=199910270825.KAA15330@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/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).