about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-10-07 16:49:50 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-10-07 16:49:50 +0000
commit1cdaf8c45920e55e438a17052b18480a39eb8fed (patch)
tree316949c485a17025a9abd16fa7f797e69731fc41
parent156a28953b82e4ac7027b0fe0eae95e27f28a46f (diff)
downloadzsh-1cdaf8c45920e55e438a17052b18480a39eb8fed.tar.gz
zsh-1cdaf8c45920e55e438a17052b18480a39eb8fed.tar.xz
zsh-1cdaf8c45920e55e438a17052b18480a39eb8fed.zip
28327: fix pseudolexical word splitting with RC_QUOTES
-rw-r--r--ChangeLog7
-rw-r--r--Src/hist.c18
2 files changed, 14 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 3defadc04..77155e779 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-10-07  Peter Stephenson  <pws@csr.com>
+
+	* 28327: Src/hist.c: Fix bufferwords() splitting when RC_QUOTES
+	is turned on.
+
 2010-10-06  Peter Stephenson  <pws@csr.com>
 
 	* 28326: Src/hist.c, Test/D04parameter.ztst: Problems with
@@ -13709,5 +13714,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5097 $
+* $Revision: 1.5098 $
 *****************************************************
diff --git a/Src/hist.c b/Src/hist.c
index a828f5660..1c626fd76 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -2368,15 +2368,6 @@ readhistfile(char *fn, int err, int readflags)
 			if (!strcmp(word, ";"))
 			    continue;
 			while (*pt) {
-			    /*
-			     * Oddity 3: "'"s can turn out differently
-			     * if RC_QUOTES is in use.
-			     */
-			    if (*pt == '\'' && pt > start &&
-				pt[-1] == '\'' && word[-1] == '\'') {
-				pt++;
-				continue;
-			    }
 			    if (!*word) {
 				bad = 1;
 				break;
@@ -2887,12 +2878,18 @@ bufferwords(LinkList list, char *buf, int *index)
     int num = 0, cur = -1, got = 0, ne = noerrs;
     int owb = wb, owe = we, oadx = addedx, ozp = zleparse, onc = nocomments;
     int ona = noaliases, ocs = zlemetacs, oll = zlemetall;
-    int forloop = 0;
+    int forloop = 0, rcquotes = opts[RCQUOTES];
     char *p, *addedspaceptr;
 
     if (!list)
 	list = newlinklist();
 
+    /*
+     * With RC_QUOTES, 'foo '' bar' comes back as 'foo ' bar'.  That's
+     * not very useful.  As nothing in here requires the fully processed
+     * string expression, we just turn the option off for this function.
+     */
+    opts[RCQUOTES] = 0;
     zleparse = 1;
     addedx = 0;
     noerrs = 1;
@@ -3095,6 +3092,7 @@ bufferwords(LinkList list, char *buf, int *index)
     wb = owb;
     we = owe;
     addedx = oadx;
+    opts[RCQUOTES] = rcquotes;
 
     if (index)
 	*index = cur;