about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Base/Completer/_expand12
2 files changed, 15 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3a152eb34..590907a13 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-04-26  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 14092: Completion/Base/Completer/_expand: make keep-prefix
+	keep everything up to the first component with a parameter
+	expansion, not only if that is at the beginning of the string
+
 2001-04-25  Sven Wischnowsky  <wischnow@zsh.org>
 
 	* 14089: Src/Zle/computil.c: fix a sizeof() to strlen(). ahem.
diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand
index 4835e4efc..8fcedea96 100644
--- a/Completion/Base/Completer/_expand
+++ b/Completion/Base/Completer/_expand
@@ -89,10 +89,16 @@ subd=("$exp[@]")
   [[ "$subd" = "$exp"(|\(N\)) ]] &&  return 1
 
 zstyle -s ":completion:${curcontext}:" keep-prefix tmp || tmp=changed
-if [[ "$word" = [\~\$]*/* && "$tmp" = (yes|true|on|1|changed) ]]; then
-  eval 'epre=( ${(e)~${word%%/*}} )' 2>/dev/null
-  if [[ -n "$epre" && $#epre -eq 1 ]]; then
+
+if [[ "$word" = (\~*/*|*\$*/*) && "$tmp" = (yes|true|on|1|changed) ]]; then
+  if [[ "$word" = *\$* ]]; then
+    opre="${(M)word##*\$[^/]##/}"
+  else
     opre="${word%%/*}"
+  fi
+  eval 'epre=( ${(e)~opre} )' 2> /dev/null
+
+  if [[ -n "$epre" && $#epre -eq 1 ]]; then
     pre="${(q)epre[1]}"
     [[ "$tmp" != changed || $#exp -gt 1 ||
        "${opre}${exp[1]#${pre}}" != "$word" ]] && exp=( ${opre}${^exp#${pre}} )