Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: tricky.c (was messages from Andrej and Bart)
- X-seq: zsh-workers 5726
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: tricky.c (was messages from Andrej and Bart)
- Date: Wed, 10 Mar 1999 10:25:00 +0100 (MET)
- In-reply-to: "Andrej Borsenkow"'s message of Tue, 9 Mar 1999 19:47:13 +0300
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author