summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-04-25 10:18:25 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-04-25 10:18:25 +0000
commitb72a9461856ab0566bd129dab4cf32e8d1dfaf91 (patch)
tree3c8cd2b4c9703f89976c64f2d6ea09358d649bb5
parentcf7b496dd5288850e2593629e1fdfacef747c5bc (diff)
downloadzsh-b72a9461856ab0566bd129dab4cf32e8d1dfaf91.tar.gz
zsh-b72a9461856ab0566bd129dab4cf32e8d1dfaf91.tar.xz
zsh-b72a9461856ab0566bd129dab4cf32e8d1dfaf91.zip
Fix handling of metafied characters in trailing whitespace on read
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c13
2 files changed, 16 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c07897b39..751ea5369 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-04-25  Peter Stephenson  <pws@csr.com>
+
+	* users/8752: stripping IFS characters after reading a line
+	in the read builtin wasn't sensitive to metafied characters.
+
 2005-04-24  Bart Schaefer  <schaefer@zsh.org>
 
 	* unposted: Src/parse.c: get rid of unused third argument of
diff --git a/Src/builtin.c b/Src/builtin.c
index 724a6baec..09034c514 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4747,8 +4747,17 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
 	}
 	signal_setmask(s);
     }
-    while (bptr > buf && iwsep(bptr[-1]))
-	bptr--;
+    while (bptr > buf) {
+	if (bptr > buf + 1 && bptr[-2] == Meta) {
+	    if (iwsep(bptr[-1] ^ 32))
+		bptr -= 2;
+	    else
+		break;
+	} else if (iwsep(bptr[-1]))
+	    bptr--;
+	else
+	    break;
+    }
     *bptr = '\0';
     if (resettty && SHTTY != -1)
 	settyinfo(&saveti);