about summary refs log tree commit diff
path: root/Completion/Core
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-16 13:45:49 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-16 13:45:49 +0000
commit4c303439d6ac04c4d0b681d9af40c95c9a90fdda (patch)
treedd8ccc37021014f20a3d7f51aaa319283b178502 /Completion/Core
parent15996aeeecedf3b94447213ea4c473650cf8afb4 (diff)
downloadzsh-4c303439d6ac04c4d0b681d9af40c95c9a90fdda.tar.gz
zsh-4c303439d6ac04c4d0b681d9af40c95c9a90fdda.tar.xz
zsh-4c303439d6ac04c4d0b681d9af40c95c9a90fdda.zip
zsh-workers/9761
Diffstat (limited to 'Completion/Core')
-rw-r--r--Completion/Core/_expand11
1 files changed, 7 insertions, 4 deletions
diff --git a/Completion/Core/_expand b/Completion/Core/_expand
index a6751290f..2bb7d4fb3 100644
--- a/Completion/Core/_expand
+++ b/Completion/Core/_expand
@@ -7,7 +7,7 @@
 # the expansions done produce no result or do not change the original
 # word from the line.
 
-local exp word="$PREFIX$SUFFIX" sort expr expl subd
+local exp word="$PREFIX$SUFFIX" sort expr expl subd suf=" "
 local curcontext="${curcontext/:[^:]#:/:expand:}"
 
 # First, see if we should insert all *completions*.
@@ -41,7 +41,7 @@ subd="$exp"
 zstyle -s ":completion:${curcontext}:" glob expr &&
     [[ "${(e):-\$[$expr]}" -eq 1 ]] &&
     exp=( ${~exp}(N) )
- 
+
 # If we don't have any expansions or only one and that is the same
 # as the original string, we let other completers run.
 
@@ -60,16 +60,19 @@ zstyle -s ":completion:${curcontext}:" sort sort
 
 [[ "$sort" = (yes|true|1|on) ]] && exp=( "${(@o)exp}" )
 
+# If there is only one expansion, add a suitable suffix
+(($#exp == 1)) && suf='' && [[ -d $exp ]] && suf='/'  
+
 if [[ -z "$compstate[insert]" ]] ;then
   _description all-expansions expl 'all expansions' "o:$word"
 
-  compadd "$expl[@]" -UQ - "$exp"
+  compadd "$expl[@]" -UQ -qS "$suf" - "$exp"
 else
   _tags all-expansions expansions original
 
 
   _requested all-expansions expl 'all expansions' "o:$word" &&
-      compadd "$expl[@]" -UQ "$exp"
+      compadd "$expl[@]" -UQ -qS "$suf" - "$exp"
 
   if _requested expansions; then
     if [[ "$sort" = menu ]]; then