zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: tricky.c (was messages from Andrej and Bart)
Date: Wed, 10 Mar 1999 10:25:00 +0100 (MET)	[thread overview]
Message-ID: <199903100925.KAA16215@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of Tue, 9 Mar 1999 19:47:13 +0300


Andrej Borsenkow wrote:

> with all but a-a-m-c patches (upto 5714):
> 
> bor@itsrm2:/tools/src/zsh-3.1.5-pws-11%> ./configure --p=/to<TAB>
> bor@itsrm2:/tools/src/zsh-3.1.5-pws-11%> ./configure --pr=/to
>                                                          ^ cursor here
> (after --pr)
> 
>    now I add `e'
> bor@itsrm2:/tools/src/zsh-3.1.5-pws-11%> ./configure --pre=/to<TAB>
>                                                           ^ cursor here
> (after --pre)
> bor@itsrm2:/tools/src/zsh-3.1.5-pws-11%> ./configure --prefix}tools/to

A little oversight in the test in `ctokenize()'.


Bart Schaefer wrote:

> Using 3.1.5-pws-11 with the patches Sven posted overnight (well, overnight
> US Pacific Time) 3/8-3/9, I get this strange behavior:
> 
> zsh% fpath=($PWD:h<TAB>
> zsh% fpath=(src/  
> 
> I expected to get "fpath=(/home/schaefer/src/" ...

That one is a poser... `expand-or-complete' never expanded this
without braces. If it expanded it, it wouldn't add a trailing slash
(but instead add a space, try `${PWD:h}<TAB>'). So this is handled by
the completion code. There, it expands the `$PWD:h', gets a path from
it, and then tries to complete the last pathname component. So I think 
the best solution would be to add a slash (and leave the line
otherwise untouched). BUT I have no idea how I can get the code to do
this... The problem is that after expansion, the code can't find out
what came from the expansion in cases like `${foo}x<TAB>'. So the
patch just uses the expanded prefix if it has the problem that the
expanded prefix contains slashes and the original string doesn't.
Maybe a better solution would be to do nothing in such cases.

The patch also contains a small cleanup in `acceptandmenucomplete()',
making `iremovesuffix()' be called when no brace expansion prefix was
collected.


Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Tue Mar  9 15:56:56 1999
+++ Src/Zle/zle_tricky.c	Wed Mar 10 10:11:35 1999
@@ -471,11 +475,8 @@
 	brbeg[l] = ',';
 	brbeg[l + 1] = '\0';
     } else {
-	int sl = suffixlen[' '];
-
 	cs = menupos + menulen + menuinsc;
-	if (sl)
-	    backdel(sl);
+	iremovesuffix(' ', 1);
 
 	inststrlen(" ", 1, 1);
 	menuinsc = menulen = 0;
@@ -5443,7 +5444,7 @@
 	if (*p == '\\')
 	    bslash = 1;
 	else {
-	    if (*p == '$' || *p == '=' || *p == '{' || *p == '}') {
+	    if (*p == '$' || *p == '{' || *p == '}') {
 		if (bslash)
 		    p[-1] = Bnull;
 		else
@@ -6198,9 +6199,12 @@
 	    if ((p = strrchr(lppre, '/'))) {
 		p[1] = '\0';
 		lppl = strlen(lppre);
-	    } else {
+	    } else if (!sf1) {
 		lppre = NULL;
 		lppl = 0;
+	    } else {
+		lppre = ppre;
+		lppl = strlen(lppre);
 	    }
 	} else {
 	    lppre = NULL;
@@ -6217,7 +6221,8 @@
 
 		strcpy(p, p + strlen(brend));
 	    }
-	    lpsuf = strchr(lpsuf, '/');
+	    if (!(lpsuf = strchr(lpsuf, '/')) && sf2)
+		lpsuf = psuf;
 	    lpsl = (lpsuf ? strlen(lpsuf) : 0);
 	} else {
 	    lpsuf = NULL;

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


             reply	other threads:[~1999-03-10  9:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-10  9:25 Sven Wischnowsky [this message]
1999-03-10 16:20 ` Bart Schaefer
1999-03-10 16:32 Sven Wischnowsky

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=199903100925.KAA16215@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).