Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Three Bugs/Problems and a Requested Feature
- X-seq: zsh-workers 280
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxx>
- To: awick@xxxxxxxxxxxxxxxxx (Andy Wick)
- Subject: Re: Three Bugs/Problems and a Requested Feature
- Date: Sun, 30 Jul 1995 22:49:21 +0100 (MET DST)
- In-reply-to: <9507260138.AA23566@yertle> from "Andy Wick" at Jul 25, 95 09:38:43 pm
- Sender: hzoli@xxxxxxxxxx
Andy Wick wrote:
>
> These 3 bugs show up in beta 10, hzoli 10.1, hzoli 10.1 with some recent patches
>
> OPTIONS: autocd correctall cshjunkieloops hashcmds hashdirs hashlistall
> interactive login mailwarning menucomplete monitor nolistbeep notify
> pathdirs shinstdin zle
>
> 1. Auto correct bug (Most important to me :)
>
> > mkdir /tmp/mpt
> > mpt=/tmp/mpt
> > cd ~mpt # This works
> > ~mpt
> OUTPUT: beta 10 and hzoli 10.1
> zsh: correct '~mpt' to 'mt' [nyae]
>
> OUTPUT: hzoli 10.1 with patches
> zsh: correct '
>
> Obviously it should just cd into the directory, and does this with most
> of my named directories. But not with ones that "can" be corrected to
> something else.
The patch below fixes this. It is only a quick fix: zsh will not try to
correct the word after a tilde (but it still corrects filenames beginning
with tilde, like ~/foo). It also handles equals substitution after this
patch, and tries to correct the name after the =. The one line patch to
zle_misc.c fixes the spelling prompt which broke after Zefram's prompt
patches in art. 265 (as Andy illustrates above). I think that Zefram forgot
to negate a condition here (am I right Zefram?).
Bye,
Zoltan
*** 1.14 1995/07/24 11:19:03
--- Src/utils.c 1995/07/30 19:13:12
***************
*** 1085,1091 ****
char *t, *u;
char firstchar;
int x;
! int pram = 0;
if (**s == '-' || **s == '%')
return;
--- 1085,1091 ----
char *t, *u;
char firstchar;
int x;
! char pref = '\0';
if (**s == '-' || **s == '%')
return;
***************
*** 1112,1121 ****
for (t = *s; *t; t++)
if (*t == '/')
break;
if (**s == String) {
if (*t)
return;
! pram = 1;
guess = *s + 1;
while (*guess == '+' || *guess == '^' ||
*guess == '#' || *guess == '~' ||
--- 1112,1123 ----
for (t = *s; *t; t++)
if (*t == '/')
break;
+ if (**s == Tilde && !*t)
+ return;
if (**s == String) {
if (*t)
return;
! pref = String;
guess = *s + 1;
while (*guess == '+' || *guess == '^' ||
*guess == '#' || *guess == '~' ||
***************
*** 1123,1128 ****
--- 1125,1139 ----
guess++;
d = 100;
scanhashtable(paramtab, spscan);
+ } else if (**s == Equals) {
+ if (*t)
+ return;
+ if (hashcmd(guess = *s + 1, pathchecked))
+ return;
+ d = 100;
+ pref = Equals;
+ scanhashtable(aliastab, spscan);
+ scanhashtable(cmdnamtab, spscan);
} else {
if ((u = spname(guess = *s)) != *s)
best = u;
***************
*** 1163,1174 ****
} else
x = 'y';
if (x == 'y' || x == ' ') {
! if (!pram) {
*s = dupstring(best);
} else {
*s = (char *) alloc(strlen(best) + 2);
strcpy(*s + 1, best);
! **s = String;
}
if (s2) {
if (*tptr && !strcmp(hlastw, *s2) && hlastw < hptr) {
--- 1174,1185 ----
} else
x = 'y';
if (x == 'y' || x == ' ') {
! if (!pref) {
*s = dupstring(best);
} else {
*s = (char *) alloc(strlen(best) + 2);
strcpy(*s + 1, best);
! **s = pref;
}
if (s2) {
if (*tptr && !strcmp(hlastw, *s2) && hlastw < hptr) {
***************
*** 1176,1183 ****
hptr = hlastw;
qbang = 1;
! if (pram)
! hwaddc('$');
for (z = best; *z; z++)
hwaddc(*z);
hwaddc(HISTSPACE);
--- 1187,1194 ----
hptr = hlastw;
qbang = 1;
! if (pref)
! hwaddc(ztokens[pref - Pound]);
for (z = best; *z; z++)
hwaddc(*z);
hwaddc(HISTSPACE);
*** 1.13 1995/07/24 17:57:08
--- Src/zle_misc.c 1995/07/29 11:57:46
***************
*** 802,808 ****
bracepos = -1;
fm = fmin;
lensb = 0;
! pmpt = (dontcount = !cnt) ? fm : NULL;
bp = bl0 = buf = zalloc(bufspc = 256);
bp1 = NULL;
--- 802,808 ----
bracepos = -1;
fm = fmin;
lensb = 0;
! pmpt = (dontcount = !cnt) ? NULL : fm;
bp = bl0 = buf = zalloc(bufspc = 256);
bp1 = NULL;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author