Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: small optimisation(s)
- X-seq: zsh-workers 10775
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: small optimisation(s)
- Date: Mon, 17 Apr 2000 10:01:18 +0200 (MET DST)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
_tags has C-code support for handling the patterns, so I can't see why
that shouldn't handle the braces, too.
And a very small optimisation in _description and a fix for a typo.
Bye
Sven
Index: Completion/Core/_description
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_description,v
retrieving revision 1.2
diff -u -r1.2 _description
--- Completion/Core/_description 2000/04/01 20:43:43 1.2
+++ Completion/Core/_description 2000/04/17 07:59:15
@@ -18,8 +18,8 @@
zstyle -s ":completion:${curcontext}:$1" format format ||
zstyle -s ":completion:${curcontext}:descriptions" format format
-zstyle -s ":completion:${curcontext}:$1" hidden hidden
-if [[ "$hidden" = (all|yes|true|1|on) ]]; then
+if zstyle -s ":completion:${curcontext}:$1" hidden hidden &&
+ [[ "$hidden" = (all|yes|true|1|on) ]]; then
[[ "$hidden" = all ]] && format=''
opts=(-n)
fi
Index: Completion/Core/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_path_files,v
retrieving revision 1.7
diff -u -r1.7 _path_files
--- Completion/Core/_path_files 2000/04/10 08:50:54 1.7
+++ Completion/Core/_path_files 2000/04/17 07:59:16
@@ -221,7 +221,7 @@
realpath=''
if [[ "$pre[1]" = / ]]; then
- # If it is a absolut path name, we remove the first slash and put it in
+ # If it is a absolute path name, we remove the first slash and put it in
# `donepath' meaning that we treat it as the path that was already handled.
# Also, we don't use the paths from `-W'.
Index: Completion/Core/_tags
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_tags,v
retrieving revision 1.3
diff -u -r1.3 _tags
--- Completion/Core/_tags 2000/04/12 12:35:38 1.3
+++ Completion/Core/_tags 2000/04/17 07:59:16
@@ -64,8 +64,7 @@
fi
;;
\!*) comptry "${(@)argv:#(${(j:|:)~${=~tag[2,-1]}})}";;
- ?*) eval "tag=( ${${tag:s/\\:/\\\\\\\\\\\\:}//(#b)([][()|*?^#~<>])/\\${match[1]}} )"
- comptry -m "${${(@)tag// /\\ }}";;
+ ?*) comptry -m "$tag";;
esac
done
Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.5
diff -u -r1.5 computil.c
--- Src/Zle/computil.c 2000/04/11 07:57:57 1.5
+++ Src/Zle/computil.c 2000/04/17 07:59:22
@@ -2425,42 +2425,64 @@
s++;
*p = '\0';
if (*q) {
- char *qq = dupstring(q);
+ char *qq, *qqq;
+
if (c)
*c = '\0';
+ qqq = qq = dupstring(q);
+ while (*qqq) {
+ if (qqq == qq || qqq[-1] != '\\') {
+ if (*qqq == '{')
+ *qqq = Inbrace;
+ else if (*qqq == '}')
+ *qqq = Outbrace;
+ else if (*qqq == ',')
+ *qqq = Comma;
+ }
+ qqq++;
+ }
tokenize(qq);
- if (haswilds(qq)) {
+ if (haswilds(qq) || hasbraces(qq)) {
Patprog prog;
- LinkNode node;
+ LinkNode bnode, node;
+ LinkList blist = newlinklist();
+
+ addlinknode(blist, qq);
+ for (bnode = firstnode(blist); bnode; incnode(bnode))
+ while (hasbraces(getdata(bnode)))
+ xpandbraces(blist, &bnode);
+
+ for (bnode = firstnode(blist); bnode; incnode(bnode)) {
+ qq = (char *) getdata(bnode);
+ if ((prog = patcompile(qq, PAT_STATIC, NULL))) {
+ char **a, *n;
+ int l = (c ? strlen(c + 1) + 2 : 1), al;
- if ((prog = patcompile(qq, PAT_STATIC, NULL))) {
- char **a, *n;
- int l = (c ? strlen(c + 1) + 2 : 1), al;
-
- for (a = all; *a; a++) {
- for (node = firstnode(list); node;
- incnode(node)) {
- char *as, *ls;
-
- for (as = *a, ls = (char *) getdata(node);
- *as && *ls && *ls != ':'; as++, ls++)
- if (*as != *ls)
+ for (a = all; *a; a++) {
+ for (node = firstnode(list); node;
+ incnode(node)) {
+ char *as, *ls;
+
+ for (as = *a, ls = (char *) getdata(node);
+ *as && *ls && *ls != ':'; as++, ls++)
+ if (*as != *ls)
+ break;
+ if (!*as && (!*ls || *ls == ':'))
break;
- if (!*as && (!*ls || *ls == ':'))
- break;
- }
- if (node)
- continue;
- if (pattry(prog, *a)) {
- n = (char *) zhalloc((al = strlen(*a)) + l);
- strcpy(n, *a);
- if (c) {
- n[al] = ':';
- strcpy(n + al + 1, c + 1);
+ }
+ if (node)
+ continue;
+ if (pattry(prog, *a)) {
+ n = (char *) zhalloc((al = strlen(*a)) + l);
+ strcpy(n, *a);
+ if (c) {
+ n[al] = ':';
+ strcpy(n + al + 1, c + 1);
+ }
+ addlinknode(list, n);
+ num++;
}
- addlinknode(list, n);
- num++;
}
}
}
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author