about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-29 06:59:00 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-29 06:59:00 +0000
commit806e8aa6afe6b8864c0124bfcdd7a0909110379b (patch)
treeb740f617fd5775ab4e0a5bb27e206d95b96ea697
parentd38f54a92862cfc054bb11bc48066fdeba8b6106 (diff)
downloadzsh-806e8aa6afe6b8864c0124bfcdd7a0909110379b.tar.gz
zsh-806e8aa6afe6b8864c0124bfcdd7a0909110379b.tar.xz
zsh-806e8aa6afe6b8864c0124bfcdd7a0909110379b.zip
quote brace-strings (12113)
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Core/_expand5
-rw-r--r--Src/Zle/zle_tricky.c20
3 files changed, 20 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 622ad7767..3d835bd50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-06-29  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 12113: Completion/Core/_expand, Src/Zle/zle_tricky.c: quote
+ 	brace-strings
+	
 2000-06-28  Bart Schaefer  <schaefer@zsh.org>
 
 	* 12112: Src/params.c: Don't make namedirs out of hash elements.
diff --git a/Completion/Core/_expand b/Completion/Core/_expand
index 6ebbfa042..d0f8d8327 100644
--- a/Completion/Core/_expand
+++ b/Completion/Core/_expand
@@ -59,8 +59,9 @@ if [[ "$force" = *s* ]] ||
    zstyle -T ":completion:${curcontext}:" substitute; then
   [[ ! -o ignorebraces && "${#${exp}//[^\{]}" = "${#${exp}//[^\}]}" ]] &&
       eval exp\=\( ${${(q)exp}:gs/\\{/\{/:gs/\\}/\}/} \)
-  exp=( ${(e)exp//\\[ 	
-]/ } )
+  exp=( ${${(e)exp//\\[ 	
+]/ }//(#b)([ 	
+])/\\$match[1]} )
 else
   exp=( ${exp:s/\\\$/\$} )
 fi
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index a4095b1a2..e081b40a1 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1464,11 +1464,12 @@ get_comp_string(void)
 			lastbrbeg = new;
 
 			new->next = NULL;
-			new->str = ztrduppfx(bbeg, len);
+			new->str = dupstrpfx(bbeg, len);
+			new->str = ztrdup(bslashquote(new->str, NULL, instring));
 			untokenize(new->str);
 			new->pos = begi;
 			*dbeg = '\0';
-			new->qpos = strlen(quotename(predup, NULL));
+			new->qpos = strlen(bslashquote(predup, NULL, instring));
 			*dbeg = '{';
 			i -= len;
 			boffs -= len;
@@ -1511,11 +1512,12 @@ get_comp_string(void)
 			    brbeg = new;
 			lastbrbeg = new;
 
-			new->str = ztrduppfx(bbeg, len);
+			new->str = dupstrpfx(bbeg, len);
+			new->str = ztrdup(bslashquote(new->str, NULL, instring));
 			untokenize(new->str);
 			new->pos = begi;
 			*dbeg = '\0';
-			new->qpos = strlen(quotename(predup, NULL));
+			new->qpos = strlen(bslashquote(predup, NULL, instring));
 			*dbeg = '{';
 			i -= len;
 			boffs -= len;
@@ -1547,7 +1549,8 @@ get_comp_string(void)
 		    new->next = brend;
 		    brend = new;
 
-		    new->str = ztrduppfx(bbeg, len);
+		    new->str = dupstrpfx(bbeg, len);
+		    new->str = ztrdup(bslashquote(new->str, NULL, instring));
 		    untokenize(new->str);
 		    new->pos = dp - predup - len + 1;
 		    new->qpos = len;
@@ -1575,11 +1578,12 @@ get_comp_string(void)
 		    brbeg = new;
 		lastbrbeg = new;
 
-		new->str = ztrduppfx(bbeg, len);
+		new->str = dupstrpfx(bbeg, len);
+		new->str = ztrdup(bslashquote(new->str, NULL, instring));
 		untokenize(new->str);
 		new->pos = begi;
 		*dbeg = '\0';
-		new->qpos = strlen(quotename(predup, NULL));
+		new->qpos = strlen(bslashquote(predup, NULL, instring));
 		*dbeg = '{';
 		boffs -= len;
 		strcpy(dbeg, dbeg + len);
@@ -1594,7 +1598,7 @@ get_comp_string(void)
 		    p = bp->pos;
 		    l = bp->qpos;
 		    bp->pos = strlen(predup + p + l);
-		    bp->qpos = strlen(quotename(predup + p + l, NULL));
+		    bp->qpos = strlen(bslashquote(predup + p + l, NULL, instring));
 		    strcpy(predup + p, predup + p + l);
 		}
 	    }