summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Base/_tilde30
-rw-r--r--Completion/Builtins/_popd18
3 files changed, 21 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index e8093256e..36bbfade4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2001-03-27  Sven Wischnowsky  <wischnow@zsh.org>
 
+	* 13789: Completion/Base/_tilde, Completion/Builtins/_popd:
+	comment out looking up the prefix-needed style when
+	completing directory stack entries; make _tilde use _popd,
+	finally
+
 	* 3752: Completion/Commands/_history_complete_word,
 	Src/Zle/compresult.c: try to make _h_c_w smarter at the
 	beginning and end of the list; avoid list-beeping if the old
diff --git a/Completion/Base/_tilde b/Completion/Base/_tilde
index 43c9b3ea4..058d218c8 100644
--- a/Completion/Base/_tilde
+++ b/Completion/Base/_tilde
@@ -24,33 +24,7 @@ while _tags; do
   _requested named-directories expl 'named directory' \
       compadd "$suf[@]" "$@" -k nameddirs
 
-  if _requested directory-stack &&
-     { ! zstyle -T ":completion:${curcontext}:directory-stack" prefix-needed ||
-       [[ "$PREFIX" = [-+]* || nm -eq compstate[nmatches] ]] }; then
-    if zstyle -T ":completion:${curcontext}:directory-stack" verbose; then
-      integer i
-
-      lines=("${PWD}" "${dirstack[@]}")
-
-      if [[ ( -prefix - && ! -o pushdminus ) ||
-	    ( -prefix + && -o pushdminus ) ]]; then
-        revlines=( $lines )
-        for (( i = 1; i <= $#lines; i++ )); do
-          lines[$i]="$((i-1)) -- ${revlines[-$i]}"
-        done
-      else
-        for (( i = 1; i <= $#lines; i++ )); do
-          lines[$i]="$((i-1)) -- ${lines[$i]}"
-        done
-      fi
-      list=( ${PREFIX[1]}${^lines%% *} )
-      disp=( -ld lines )
-    else
-      list=( ${PREFIX[1]}{0..${#dirstack}} )
-      disp=()
-    fi
-    _all_labels -V directory-stack expl 'directory stack' \
-        compadd "$suf[@]" "$disp[@]" -Q -a list && ret=0
-  fi
+  _requested directory-stack && _popd "$suf[@]" && ret=0
+
   (( ret )) || return 0
 done
diff --git a/Completion/Builtins/_popd b/Completion/Builtins/_popd
index f551bb299..f79aa947f 100644
--- a/Completion/Builtins/_popd
+++ b/Completion/Builtins/_popd
@@ -7,10 +7,20 @@
 
 setopt localoptions nonomatch
 
-local expl list lines revlines disp
+local expl list lines revlines disp suf
 
-! zstyle -T ":completion:${curcontext}:directory-stack" prefix-needed ||
-    [[ $PREFIX = [-+]* ]] || return 1
+if [[ "$SUFFIX" = */* ]]; then
+  ISUFFIX="/${SUFFIX#*/}$ISUFFIX"
+  SUFFIX="${SUFFIX%%/*}"
+  suf=(-S '')
+else
+  suf=(-qS/)
+fi
+
+### we decided against this, for now...
+#! zstyle -T ":completion:${curcontext}:directory-stack" prefix-needed ||
+
+[[ $PREFIX = [-+]* ]] || return 1
 
 if zstyle -T ":completion:${curcontext}:directory-stack" verbose; then
   # get the list of directories with their canonical number
@@ -38,4 +48,4 @@ else
 fi
 
 _wanted -V directory-stack expl 'directory stack' \
-    compadd "$@" "$disp[@]" -Q -a list
+    compadd "$@" "$suf[@]" "$disp[@]" -Q -a list