about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--Completion/Unix/Command/_sccs18
2 files changed, 19 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index afa54b3cc..5181e859c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2003-02-20  Oliver Kiddle <opk@zsh.org>
+2003-02-21  Oliver Kiddle  <opk@zsh.org>
+
+	* 18269: Completion/Unix/Command/_sccs: improve file completion
+	to handle both direct and indirect references to s. files
+
+2003-02-20  Oliver Kiddle  <opk@zsh.org>
 
 	* 18263: Src/glob.c: fix saving of glob state so that globs can
 	be used from the (e) glob qualifier
diff --git a/Completion/Unix/Command/_sccs b/Completion/Unix/Command/_sccs
index e4af91a97..ed0dd516d 100644
--- a/Completion/Unix/Command/_sccs
+++ b/Completion/Unix/Command/_sccs
@@ -2,10 +2,17 @@
 
 (( $+functions[_sccs_files] )) ||
 _sccs_files() {
-  local dir=${PROJECTDIR:-~+}/${PREFIX##*/}/$finalpath
-
-  compset -P '*/'
-  _files -W $dir -g \*\(:s/s.//\) "$@"
+  local dir expl ret=1 pref=$PREFIX ipref=$IPREFIX
+  dir="${(M)PREFIX##*/}$finalpath"
+  [[ $~dir = (.|..|)/* ]] || dir="${PROJECTDIR:-~+}/$dir"
+  compset -P "*/"
+  _wanted file expl file compadd "$@" - $~dir/*(N.:t:s/s.//) && ret=0
+  PREFIX="$pref"
+  IPREFIX="$ipref"
+  _wanted sccs-files expl 'sccs file' _files -W ${PROJECTDIR:-~+} \
+      -g 's.*' && ret=0
+  
+  return ret
 }
 
 local curcontext="$curcontext" state line
@@ -20,7 +27,7 @@ subcmds=(
 
 ropt='-r+[specify sccs delta id]:sccs delta id'
 copt='-c+[specify date]:date-stamp'
-sfiles=':file:_sccs_files'
+sfiles=":file:_files -g s.\*"
 
 if [[ $service = sccs ]]; then
   _arguments -C -A "-*" \
@@ -34,6 +41,7 @@ if [[ $service = sccs ]]; then
     return
   fi
   service="$words[1]"
+  sfiles=':file:_sccs_files'
   curcontext="${curcontext%:*}-$service:"
 fi
 finalpath="${opt_args[-p]:-SCCS}"