about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/compcore.c1
-rw-r--r--Src/Zle/zle_tricky.c10
-rw-r--r--Src/utils.c14
4 files changed, 27 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3c2de7d45..d0d0f4383 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-12-08  Peter Stephenson  <pws@csr.com>
+
+	* 23036: Src/utils.c, Src/Zle/compcore.c, Src/Zle/zle_tricky.c:
+	three more fixes for completion using $'...'.
+
 2006-12-04  Peter Stephenson  <pws@csr.com>
 
 	* 23028: configure.ac, Config/defs.mk.in, Doc/Makefile.in:
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index b49fdd5c5..a21b83569 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -1653,6 +1653,7 @@ set_comp_sep(void)
 	    instring = QT_DOLLARS;
 	    nsptr++;
 	    tsptr++;
+	    swb++;
 	    break;
 	}
 
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index d678487db..1393027f7 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1032,6 +1032,16 @@ static int
 has_real_token(const char *s)
 {
     while (*s) {
+	/*
+	 * Special action required for $' strings, which
+	 * need to be treated like nulls.
+	 */
+	if ((*s == Qstring && s[1] == '\'') ||
+	    (*s == String && s[1] == Snull))
+	{
+	    s += 2;
+	    continue;
+	}
 	if (itok(*s) && !inull(*s))
 	    return 1;
 	s++;
diff --git a/Src/utils.c b/Src/utils.c
index de1a219f7..a0f762896 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -4292,9 +4292,17 @@ quotestring(const char *s, char **e, int instring)
 		if (!*u)
 		    u--;
 		continue;
-	    }
-	    else if ((*u == String || *u == Qstring) &&
-		     (u[1] == Inpar || u[1] == Inbrack || u[1] == Inbrace)) {
+	    } else if ((*u == Qstring || *u == '$') && u[1] == '\'' &&
+		       instring == QT_DOUBLE) {
+		/*
+		 * We don't need to quote $'...' inside a double-quoted
+		 * string.  This is largely cosmetic; it looks neater
+		 * if we don't but it doesn't do any harm since the
+		 * \ is stripped.
+		 */
+		*v++ = *u++;
+	    } else if ((*u == String || *u == Qstring) &&
+		       (u[1] == Inpar || u[1] == Inbrack || u[1] == Inbrace)) {
 		char c = (u[1] == Inpar ? Outpar : (u[1] == Inbrace ?
 						    Outbrace : Outbrack));
 		char beg = *u;