Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH?] Re: Autocorrect for commands with a hyphen (dash) in the name
- X-seq: zsh-workers 45901
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: [PATCH?] Re: Autocorrect for commands with a hyphen (dash) in the name
- Date: Sat, 23 May 2020 12:33:27 -0700
- In-reply-to: <CAH+w=7aqAO37qpSvtmJXMPWq3zP=pUAZCe3i-BFyn0knRmFjVQ@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAOoO2vg=-9P7v=ATOzrbh6VF35o_xzK_-yF+EA6OgTHsQBik-A@mail.gmail.com> <CAH+w=7bKpm7GO2ZhbA5Apr0sBDz5=kmX1=WK2X0nTcWxpkHPPQ@mail.gmail.com> <ab8b7655-83e8-45b2-889f-043314faea62@www.fastmail.com> <CAH+w=7aqAO37qpSvtmJXMPWq3zP=pUAZCe3i-BFyn0knRmFjVQ@mail.gmail.com>
[Moving to -workers from -users]
On Tue, May 19, 2020 at 2:25 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> So, the following? Or should this also have the equivalent of
>
> if (*w == Tilde || *w == Equals || *w == String)
> *x = *w;
>
> like zle_tricky.c?
Any comment on this?
> diff --git a/Src/lex.c b/Src/lex.c
> index a541def..615da5a 100644
> --- a/Src/lex.c
> +++ b/Src/lex.c
> @@ -1868,8 +1868,12 @@ exalias(void)
> hwend();
> if (interact && isset(SHINSTDIN) && !strin && incasepat <= 0 &&
> tok == STRING && !nocorrect && !(inbufflags & INP_ALIAS) &&
> - (isset(CORRECTALL) || (isset(CORRECT) && incmdpos)))
> - spckword(&tokstr, 1, incmdpos, 1);
> + (isset(CORRECTALL) || (isset(CORRECT) && incmdpos))) {
> + char *x = dupstring(tokstr);
> + untokenize(x);
> + spckword(&x, 1, incmdpos, 1);
> + tokenize(tokstr = x);
> + }
>
> if (!tokstr) {
> zshlextext = tokstrings[tok];
Messages sorted by:
Reverse Date,
Date,
Thread,
Author