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

PATCH: Re: ~user completion in single quotes.



Tanaka Akira wrote:

> Z(4):akr@serein% Src/zsh -f                        
> serein% bindkey -e; autoload -U compinit; compinit -D
> serein% echo '~ro<TAB>
> ->
> serein% echo '~root/
> 
> User names are completed even in single quotes.  I think it shouldn't.
> 
> serein% echo '~akr/zs<TAB>
> ->
> serein% echo '~akr/zsh/    
> 
> serein% echo '$PWD/C<TAB
> CVS/            ChangeLog       ChangeLog.3.0   Completion/     Config/
> 
> Hm. _path_files expands `~akr' and `$PWD' even in single quotes.

Hmhm, seems sensible, because there is `compset -q' for real in-quote
completion.


Bye
 Sven

Index: Completion/Base/_tilde
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_tilde,v
retrieving revision 1.3
diff -u -r1.3 _tilde
--- Completion/Base/_tilde	2000/04/25 11:00:06	1.3
+++ Completion/Base/_tilde	2000/05/16 11:22:27
@@ -4,6 +4,8 @@
 # for you or if there are too many of them, you may want to use
 # `compadd -qS/ - "$friends[@]"' or something like that.
 
+[[ -n "$compstate[quote]" ]] && return 1
+
 local expl suf dirs list lines revlines i ret disp nm="$compstate[nmatches]"
 
 if [[ "$SUFFIX" = */* ]]; then
Index: Completion/Core/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_path_files,v
retrieving revision 1.13
diff -u -r1.13 _path_files
--- Completion/Core/_path_files	2000/05/15 10:45:24	1.13
+++ Completion/Core/_path_files	2000/05/16 11:22:27
@@ -160,7 +160,7 @@
 
 # Now let's have a closer look at the string to complete.
 
-if [[ "$pre[1]" = \~ ]]; then
+if [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then
   # It begins with `~', so remember anything before the first slash to be able
   # to report it to the completion code. Also get an expanded version of it
   # (in `realpath'), so that we can generate the matches. Then remove that
@@ -209,7 +209,7 @@
   orig="${orig#*/}"
   donepath=
   prepaths=( '' )
-elif [[ "$pre" = *\$*/* ]]; then
+elif [[ "$pre" = *\$*/* && -z "$compstate[quote]" ]]; then
 
   # If there is a parameter expansion in the word from the line, we try
   # to complete the beast by expanding the prefix and completing anything

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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