about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-26 07:02:47 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-26 07:02:47 +0000
commit105009726b3276a16ad39930aba046032597a039 (patch)
tree31d967dbb37843a45029fd02049955b577446dfb
parentd76a39d01b03684bc45c09743b4fe591375ca7f2 (diff)
downloadzsh-105009726b3276a16ad39930aba046032597a039.tar.gz
zsh-105009726b3276a16ad39930aba046032597a039.tar.xz
zsh-105009726b3276a16ad39930aba046032597a039.zip
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 (14092)
-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}} )