about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-17 08:04:42 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-17 08:04:42 +0000
commitcd45aa331dc206b1b40c5be5e222d46148bf42ac (patch)
treeed0ecfb9fae0dcfee5c9adefeb4ddab848a032d3
parent8c474bbcd4c78ec465e7198a0bbb47def78374a8 (diff)
downloadzsh-cd45aa331dc206b1b40c5be5e222d46148bf42ac.tar.gz
zsh-cd45aa331dc206b1b40c5be5e222d46148bf42ac.tar.xz
zsh-cd45aa331dc206b1b40c5be5e222d46148bf42ac.zip
make _tags use C-code for braces in tag-order values; and misc. stuff (10775)
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Core/_description4
-rw-r--r--Completion/Core/_path_files2
-rw-r--r--Completion/Core/_tags3
-rw-r--r--Src/Zle/computil.c80
5 files changed, 59 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index 69a521487..04c32a92a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2000-04-17  Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
 
+	* 10775: Completion/Core/_description, Completion/Core/_path_files,
+ 	Completion/Core/_tags, Src/Zle/computil.c: make _tags use C-code
+ 	for braces in tag-order values; and misc. stuff
+	
 	* 10774: Src/Zle/compmatch.c: fix for partial word completion with
  	empty parts and common suffix
 	
diff --git a/Completion/Core/_description b/Completion/Core/_description
index 7db47228b..6ee1026bd 100644
--- a/Completion/Core/_description
+++ b/Completion/Core/_description
@@ -18,8 +18,8 @@ name="$2"
 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
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index 377b9b7d0..1744c280b 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -221,7 +221,7 @@ else
   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'.
 
diff --git a/Completion/Core/_tags b/Completion/Core/_tags
index 205fdb367..496f5b7e0 100644
--- a/Completion/Core/_tags
+++ b/Completion/Core/_tags
@@ -64,8 +64,7 @@ if (( $# )); then
              fi
              ;;
       \!*)   comptry "${(@)argv:#(${(j:|:)~${=~tag[2,-1]}})}";;
-      ?*)    eval "tag=( ${${tag:s/\\:/\\\\\\\\\\\\:}//(#b)([][()|*?^#~<>])/\\${match[1]}} )" 
-             comptry -m "${${(@)tag// /\\ }}";;
+      ?*)    comptry -m "$tag";;
       esac
     done
 
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 09746c1bb..129119799 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -2425,42 +2425,64 @@ bin_comptry(char *nam, char **args, char *ops, int func)
 			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;
-
-			    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)
+			    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;
+
+				    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);
 					}
-					addlinknode(list, n);
-					num++;
+					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++;
+					}
 				    }
 				}
 			    }