zsh-workers
 help / color / mirror / code / Atom feed
* Re: Globbing and RC_EXPAND_PARAM
       [not found] <200005030841.KAA23096@beta.informatik.hu-berlin.de>
@ 2000-05-03 10:39 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2000-05-03 10:39 UTC (permalink / raw)
  To: zsh-workers, Sven Wischnowsky

On May 3, 10:41am, Sven Wischnowsky wrote:
} Subject: Re: Globbing and RC_EXPAND_PARAM
}
} Not very nice either: *(/e:REPLY=-I\$REPLY)
} 
} Whoa! Dirty tricks ;-)

zagzig[86] echo *(/e:REPLY=-I\$REPLY)
zsh: missing end of string
zagzig[87] echo *(/e:REPLY=-I\$REPLY:)
-ICVS -ICompletion -IConfig -IDoc -IEtc -IFunctions -IMisc -ISrc -IStartupFiles
-ITest -IUtil

Pretty cool, but one can play hell with _expand this way ...

zagzig[91] echo Completion/*(/e:REPLY=-I\$REPLY:)
zagzig[91] echo -I$REPLY -I$REPLY -I$REPLY -I$REPLY -I$REPLY -I$REPLY -I$REPLY
-I$REPLY -I$REPLY -I$REPLY -I$REPLY
Completing all expansions
-I$REPLY -I$REPLY -I$REPLY -I$REPLY -I$REPLY -I$REPLY -I$REPLY -I$REPLY
-I$REPLY -I$REPLY -I$REPLY
Completing expansions
-I$REPLY 
Completing original
Completion/*(/e:REPLY=-I\$REPLY:) 


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Globbing and RC_EXPAND_PARAM
@ 2000-05-03 11:49 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2000-05-03 11:49 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> On May 3, 10:41am, Sven Wischnowsky wrote:
> } Subject: Re: Globbing and RC_EXPAND_PARAM
> }
> } Not very nice either: *(/e:REPLY=-I\$REPLY)
> } 
> } Whoa! Dirty tricks ;-)
> 
> zagzig[86] echo *(/e:REPLY=-I\$REPLY)
> zsh: missing end of string

Sorry...

> zagzig[87] echo *(/e:REPLY=-I\$REPLY:)
> -ICVS -ICompletion -IConfig -IDoc -IEtc -IFunctions -IMisc -ISrc -IStartupFiles
> -ITest -IUtil
> 
> Pretty cool, but one can play hell with _expand this way ...
> 
> zagzig[91] echo Completion/*(/e:REPLY=-I\$REPLY:)
> zagzig[91] echo -I$REPLY -I$REPLY -I$REPLY -I$REPLY -I$REPLY -I$REPLY -I$REPLY
> -I$REPLY -I$REPLY -I$REPLY -I$REPLY
> Completing all expansions
> -I$REPLY -I$REPLY -I$REPLY -I$REPLY -I$REPLY -I$REPLY -I$REPLY -I$REPLY
> -I$REPLY -I$REPLY -I$REPLY
> Completing expansions
> -I$REPLY 
> Completing original
> Completion/*(/e:REPLY=-I\$REPLY:) 

With `substitute' set to zero, yes. Hrmpf, the ${(e)...} neatly
removes the backslash before the `$'. Since that isn't special to
globbing, I think we should just add to code to remove such
backslashes when `substitute' is zero.


And then I noticed that complist had a problem with clearing the end
of the previously shown list in a menu selection when the prompt went
from spanning multiple lines to only one line. Again. An off-by-one
error.


Bye
 Sven

Index: Completion/Core/_expand
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_expand,v
retrieving revision 1.7
diff -u -r1.7 _expand
--- Completion/Core/_expand	2000/05/02 15:52:44	1.7
+++ Completion/Core/_expand	2000/05/03 11:48:31
@@ -35,11 +35,14 @@
 # changes quoted spaces, tabs, and newlines into spaces and protects
 # this function from aborting on parse errors in the expansion.
 
-{ zstyle -s ":completion:${curcontext}:" substitute expr ||
-  { [[ "$curcontext" = expand-word:* ]] && expr=1 } } &&
-    [[ "${(e):-\$[$expr]}" -eq 1 ]] &&
-    exp=( ${(f)"$(print -lR - ${(e)exp//\\[ 	
+if { zstyle -s ":completion:${curcontext}:" substitute expr ||
+     { [[ "$curcontext" = expand-word:* ]] && expr=1 } } &&
+       [[ "${(e):-\$[$expr]}" -eq 1 ]]; then
+  exp=( ${(f)"$(print -lR - ${(e)exp//\\[ 	
 ]/ })"} ) 2>/dev/null
+else
+  exp=( "${exp:s/\\\$/\$}" )
+fi
 
 # If the array is empty, store the original string again.
 
@@ -117,7 +120,7 @@
       if [[ -d "$i" && "$i" != */ ]]; then
         dir=( "$dir[@]" "$i" )
       else
-	normal=( "$dir[@]" "$i" )
+	normal=( "$normal[@]" "$i" )
       fi
     done
     (( $#dir ))    && compadd "$expl[@]" -UQ -qS/ - "$dir[@]"
Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.12
diff -u -r1.12 complist.c
--- Src/Zle/complist.c	2000/04/28 07:39:08	1.12
+++ Src/Zle/complist.c	2000/05/03 11:48:32
@@ -985,7 +985,7 @@
 	lastml = 0;
     }
     cl = (listdat.nlines > lines - nlnct - mhasstat ?
-	  lines - nlnct - mhasstat : listdat.nlines);
+	  lines - nlnct - mhasstat : listdat.nlines) - 1;
     mrestlines = lines - 1;
 
     if (cl < 2) {

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-05-03 11:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200005030841.KAA23096@beta.informatik.hu-berlin.de>
2000-05-03 10:39 ` Globbing and RC_EXPAND_PARAM Bart Schaefer
2000-05-03 11:49 Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).