zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: Globbing and RC_EXPAND_PARAM
Date: Wed, 3 May 2000 13:49:01 +0200 (MET DST)	[thread overview]
Message-ID: <200005031149.NAA31380@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Wed, 3 May 2000 10:39:21 +0000


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


             reply	other threads:[~2000-05-03 11:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-03 11:49 Sven Wischnowsky [this message]
     [not found] <200005030841.KAA23096@beta.informatik.hu-berlin.de>
2000-05-03 10:39 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200005031149.NAA31380@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).