zsh-workers
 help / color / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [PATCH?] Re: Autocorrect for commands with a hyphen (dash) in the name
Date: Sat, 23 May 2020 12:33:27 -0700
Message-ID: <CAH+w=7a=AB5ksiU7Tv2A3xnr2TVd=LAfQ--M0B=Vq56T_k+xyA@mail.gmail.com> (raw)
In-Reply-To: <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@brasslantern.com> 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];

       reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAOoO2vg=-9P7v=ATOzrbh6VF35o_xzK_-yF+EA6OgTHsQBik-A@mail.gmail.com>
     [not found] ` <CAH+w=7bKpm7GO2ZhbA5Apr0sBDz5=kmX1=WK2X0nTcWxpkHPPQ@mail.gmail.com>
     [not found]   ` <ab8b7655-83e8-45b2-889f-043314faea62@www.fastmail.com>
     [not found]     ` <CAH+w=7aqAO37qpSvtmJXMPWq3zP=pUAZCe3i-BFyn0knRmFjVQ@mail.gmail.com>
2020-05-23 19:33       ` Bart Schaefer [this message]
2020-05-23 19:44         ` Peter Stephenson
2020-05-23 19:54           ` Bart Schaefer
2020-05-23 20:30             ` Peter Stephenson
2020-05-23 21:18               ` Bart Schaefer
2020-05-24 17:11                 ` Peter Stephenson
2020-05-24 18:39                   ` Bart Schaefer
2020-05-25  5:46                     ` Bart Schaefer
2020-05-25 16:35                       ` Peter Stephenson

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='CAH+w=7a=AB5ksiU7Tv2A3xnr2TVd=LAfQ--M0B=Vq56T_k+xyA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /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

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git