about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-08-22 10:46:40 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-08-22 10:46:40 +0000
commit749951e03d1d6036f97a45b65c0a7a85c2eecabd (patch)
tree3be46925c4bc5061dab7285e2b4e930b2b7d0658
parent55b7a07a7ec62cd2456b651cabf819e4384f73b0 (diff)
downloadzsh-749951e03d1d6036f97a45b65c0a7a85c2eecabd.tar.gz
zsh-749951e03d1d6036f97a45b65c0a7a85c2eecabd.tar.xz
zsh-749951e03d1d6036f97a45b65c0a7a85c2eecabd.zip
23792: test and documentation for improved backslash quoting
-rw-r--r--ChangeLog3
-rw-r--r--Doc/Zsh/expn.yo10
-rw-r--r--Test/D07multibyte.ztst6
3 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 48a65703c..78a9684b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2007-08-22  Peter Stephenson  <pws@csr.com>
 
+	* 23792: Doc/Zsh/expn.yo, Test/D07multibyte.ztst:  test
+	and documentation for 23784.
+
 	* 23791: Src/Zle/zle_refresh.c: use VARARR for arrays with
 	MB_CUR_MAX.
 
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index 2460f148e..cff393c57 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -792,10 +792,14 @@ have `tt(foo=bar)' and `tt(bar=baz)', the strings tt(${(P)foo}),
 tt(${(P)${foo}}), and tt(${(P)$(echo bar)}) will be expanded to `tt(baz)'.
 )
 item(tt(q))(
-Quote the resulting words with backslashes. If this flag is given
+Quote the resulting words with backslashes; unprintable or invalid
+characters are quoted using the tt($'\)var(NNN)tt(') form, with separate
+quotes for each octet.  If this flag is given
 twice, the resulting words are quoted in single quotes and if it is
-given three times, the words are quoted in double quotes. If it is
-given four times, the words are quoted in single quotes preceded by a tt($).
+given three times, the words are quoted in double quotes; in these forms
+no special handling of unprintable or invalid characters is attempted.  If
+the flag is given four times, the words are quoted in single quotes
+preceded by a tt($).
 )
 item(tt(Q))(
 Remove one level of quotes from the resulting words.
diff --git a/Test/D07multibyte.ztst b/Test/D07multibyte.ztst
index 35e2bd50f..7348bbc2e 100644
--- a/Test/D07multibyte.ztst
+++ b/Test/D07multibyte.ztst
@@ -378,3 +378,9 @@
 >ngs200.txt
 >ngs20.txt
 >ngs2.txt
+
+# Not strictly multibyte, but gives us a well-defined locale for testing.
+  foo=$'X\xc0Y\x07Z\x7fT'
+  print -r ${(q)foo}
+0:Backslash-quoting of unprintable/invalid characters uses $'...'
+>X$'\300'Y$'\a'Z$'\177'T