Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: expansion after a redirection operator



With multios, if you type:
	echo hello >*
it will put `hello' into every file. But, if you do
	echo hello >*<tab>
files are expanded without the redirection operators so the resulting
command does something quite different.

This patch puts the redirection operators in for every word resulting
from an expansion where all-expansions are generated. I think this also
makes sense for the other types of expansion besides glob expansion.

I had to move the all-expansion bit down so the changed exp didn't
affect other code so the patch looks longer than it really is.

Oliver

Index: Completion/Base/Completer/_expand
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Completer/_expand,v
retrieving revision 1.5
diff -u -r1.5 _expand
--- Completion/Base/Completer/_expand   2001/05/02 08:58:56     1.5
+++ Completion/Base/Completer/_expand   2001/05/09 12:00:00
@@ -150,17 +150,6 @@
 else
   _tags all-expansions expansions original
 
-  if _requested all-expansions expl 'all expansions'; then
-    local disp dstr
-
-    if [[ "${#${exp}}" -ge COLUMNS ]]; then
-      disp=( -ld dstr )
-      dstr=( "${(r:COLUMNS-5:)exp} ..." )
-    else
-      disp=()
-    fi
-    compadd "$disp[@]" "$expl[@]" -UQ -qS "$suf" - "$exp"
-  fi
   if [[ $#exp -gt 1 ]] && _requested expansions; then
     local i j normal space dir
 
@@ -186,6 +175,18 @@
     (( $#dir ))    && compadd "$expl[@]" -UQ -qS/ -a dir
     (( $#space ))  && compadd "$expl[@]" -UQ -qS " " -a space
     (( $#normal )) && compadd "$expl[@]" -UQ -qS "" -a normal
+  fi
+  if _requested all-expansions expl 'all expansions'; then
+    local disp dstr
+
+    if [[ "${#${exp}}" -ge COLUMNS ]]; then
+      disp=( -ld dstr )
+      dstr=( "${(r:COLUMNS-5:)exp} ..." )
+    else
+      disp=()
+    fi
+    [[ -o multios ]] && exp=($exp[1] $compstate[redirect]${^exp[2,-1]})
+    compadd "$disp[@]" "$expl[@]" -UQ -qS "$suf" - "$exp"
   fi
 
   _requested original expl original && compadd "$expl[@]" -UQ - "$word"



Messages sorted by: Reverse Date, Date, Thread, Author