about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-05-08 10:30:45 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-05-08 10:30:45 +0000
commit78b02d9c036f6b0e0ec7896729a090ec7ccc7a5f (patch)
treebbba018cb7d52a3f7ea8dd3bcb6832f06be59132
parent9d071829ecbcb34128c34d4b2855342f81f1dd48 (diff)
downloadzsh-78b02d9c036f6b0e0ec7896729a090ec7ccc7a5f.tar.gz
zsh-78b02d9c036f6b0e0ec7896729a090ec7ccc7a5f.tar.xz
zsh-78b02d9c036f6b0e0ec7896729a090ec7ccc7a5f.zip
18512: fix 18508 properly this time.
-rw-r--r--ChangeLog10
-rw-r--r--Completion/Unix/Command/_cvs9
-rw-r--r--Completion/Unix/Command/_perforce4
-rw-r--r--Completion/Unix/Command/_rsync7
-rw-r--r--Completion/Unix/Type/_path_files3
-rw-r--r--Doc/Zsh/expn.yo4
-rw-r--r--README9
7 files changed, 34 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index a942e5407..5128156c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2003-05-08  Peter Stephenson  <pws@csr.com>
+
+	* 18512: README, Completion/Unix/Command/_cvs,
+	Completion/Unix/Command/_perforce, Completion/Unix/Command/_rsync,
+	Completion/Unix/Type/_path_files, Doc/Zsh/expn.yo: 18508 wasn't
+	enough; the \\/ hack was documented and in use in the completion
+	system.  Change the documentation, mention the inconsistency in
+	README and alter the completion system to hide the `/' a parameter
+	so that it doesn't care.
+
 2003-05-07  Oliver Kiddle  <opk@zsh.org>
 
 	* users/6083: Completion/Unix/Command/_rlogin,
diff --git a/Completion/Unix/Command/_cvs b/Completion/Unix/Command/_cvs
index ea67c0ea4..c2ddb2e2c 100644
--- a/Completion/Unix/Command/_cvs
+++ b/Completion/Unix/Command/_cvs
@@ -611,7 +611,7 @@ _cvs_loadstat () {
 
 (( $+functions[_cvs_root] )) ||
 _cvs_root () {
-  local cvspassfile id
+  local cvspassfile id slash
 
   typeset -gU _cvs_roots
 
@@ -622,7 +622,8 @@ _cvs_root () {
       id="$(LC_ALL=C ls -l "$cvspassfile")"
     fi
     if [[ "$id" != "$_cvs_pass_id" ]]; then
-      _cvs_roots=($_cvs_roots ${${${${(f)"$(<$cvspassfile)"}#/1 }%% *}/:2401\\//:/})
+      slash=/
+      _cvs_roots=($_cvs_roots ${${${${(f)"$(<$cvspassfile)"}#/1 }%% *}/:2401${slash}/:/})
       _cvs_pass_id="$id"
     fi
   fi
@@ -918,13 +919,13 @@ _cvs_existing_entries () {
 (( $+functions[_cvs_modified_entries] )) ||
 _cvs_modified_entries () {
   if _cvs_loadstat; then
-    local expl match linedir realdir pat
+    local expl match linedir realdir pat slash=/
     match=()
     : ${PREFIX:#(#b)(*/)(*)}
     linedir="$match[1]"
     realdir=${(e)~linedir}
     [[ -f "$realdir"CVS/Entries ]] &&
-    [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}/\\/[^\\/]#\\///}%/[^/]#/[^/]#}:#${(j:|:)~${${${${(f)"$(LC_ALL=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${realdir}*(D) 2>/dev/null)"}##*/}/ //}//(#m)[][*?()<|^~#\\]/\\$MATCH}}}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}"} ]] &&
+    [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}/${slash}[^${slash}]#${slash}//}%/[^/]#/[^/]#}:#${(j:|:)~${${${${(f)"$(LC_ALL=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${realdir}*(D) 2>/dev/null)"}##*/}/ //}//(#m)[][*?()<|^~#\\]/\\$MATCH}}}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}"} ]] &&
     _wanted files expl 'modified file' _path_files -g "$pat"
   else
     _cvs_existing_entries
diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce
index 3c7ee914c..9bcec8884 100644
--- a/Completion/Unix/Command/_perforce
+++ b/Completion/Unix/Command/_perforce
@@ -906,7 +906,7 @@ _perforce_jobviews() {
     # by various logical operators.  The `=' could be a comparison,
     # but we don't currently bother with that here; it's a bit cumbersome
     # to complete.
-    local line type oldifs=$IFS IFS= key value
+    local line type oldifs=$IFS IFS= key value slash=/
     local match mbegin mend
     # This is simply to split out two space-delimited words a backreferences.
     local m2words
@@ -962,7 +962,7 @@ _perforce_jobviews() {
 
     for key in ${(k)p4fields}; do
 	if [[ -n ${p4values[$key]} ]]; then
-	    valuespec+=("${key}:${p4fields[$key]}:(${p4values[$key]//\\// })")
+	    valuespec+=("${key}:${p4fields[$key]}:(${p4values[$key]//$slash/ })")
 	elif [[ $key = job ]]; then
 	    # Nothing special for jobs; add our own completion.
 	    valuespec+=("${key}:Perforce job:_perforce_jobs")
diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync
index 8120c10a9..b6fa296a1 100644
--- a/Completion/Unix/Command/_rsync
+++ b/Completion/Unix/Command/_rsync
@@ -31,13 +31,14 @@ elif [[ -prefix 1 *:: ]]; then
   _describe "remote modules" remmodules -S/
 
 elif [[ -prefix 1 *: ]]; then
-  local remfiles remdispf remdispd
+  local remfiles remdispf remdispd slash
 
   compset -P 1 '*:'
 
   if zstyle -T ":completion:${curcontext}:" remote-access; then
+    slash=/
     remfiles=(${(f)"$(ssh -a -x ${words[CURRENT]%:*} ls -d1F ${${${words[CURRENT
-]#*:}:h}/\\/(#e)/}/\* 2>/dev/null)"})
+]#*:}:h}/${slash}(#e)/}/\* 2>/dev/null)"})
 
     remdispf=(${remfiles:#*/})
     remdispd=(${(M)remfiles:#*/})
@@ -46,7 +47,7 @@ elif [[ -prefix 1 *: ]]; then
       compadd -d remdispf ${${remfiles:#*/}/[*=@|](#e)/}
       
     _wanted files expl 'remote files and directories' \
-      compadd -S/ -d remdispd ${${(M)remfiles:#*/}/\\/(#e)/}
+      compadd -S/ -d remdispd ${${(M)remfiles:#*/}/${slash}(#e)/}
   else
     _message -e remote-files 'remote files'
   fi
diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index e33e17d6b..fc8edca02 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -208,7 +208,8 @@ if [[ "$pre" = [^][*?#^\|\<\>\\]#(\`[^\`]#\`|\$)*/* && "$compstate[quote]" != \'
   eval 'realpath=${(e)~linepath}' 2>/dev/null
   [[ -z "$realpath" || "$realpath" = "$linepath" ]] && return 1
   pre="${pre#${linepath}}"
-  i="${#linepath//[^\\/]}"
+  i='[^/]'
+  i="${#linepath//$i}"
   orig="${orig[1,(in:i:)/][1,-2]}"
   donepath=
   prepaths=( '' )
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index d4d509e47..f61cb7aa8 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -510,8 +510,8 @@ The var(pattern) may begin with a `tt(#)', in which case the
 var(pattern) must match at the start of the string, or `tt(%)', in
 which case it must match at the end of the string.  The var(repl) may
 be an empty string, in which case the final `tt(/)' may also be omitted.
-To quote the final `tt(/)' in other cases it should be preceded by two
-backslashes (i.e., a quoted backslash); this is not necessary if the
+To quote the final `tt(/)' in other cases it should be preceded by a
+single backslash; this is not necessary if the
 `tt(/)' occurs inside a substituted parameter.  Note also that the `tt(#)'
 and `tt(%)' are not active if they occur inside a substituted parameter,
 even at the start.
diff --git a/README b/README
index 0c4929127..53e50c4f3 100644
--- a/README
+++ b/README
@@ -39,6 +39,15 @@ The `=prog' facility for expanding command paths (provided the EQUALS
 option is enabled, as it is by default) no longer expands aliases.  It was
 felt this feature was underused and confusing.
 
+In 4.0, a literal `/' was quoted in the `src' text of a substitution of the
+form `${foo/src/rep}' or ${foo//src/rep} with two backslashes.  This was
+documented, but inconsistent with normal quoting conventions and poorly
+implemented.  The `/' now requires only one backslash to quote it whether
+or not the expression occurs in double quotes.  For example:
+  % foo=word/bird
+  % print ${foo/\//-} "${foo/\//+}"
+  word-bird word+bird
+
 Documentation
 -------------