summary refs log tree commit diff
path: root/Completion/Builtins
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Builtins')
-rw-r--r--Completion/Builtins/_popd18
1 files changed, 14 insertions, 4 deletions
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