Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH?] Re: Autocorrect for commands with a hyphen (dash) in the name
- X-seq: zsh-workers 45910
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: [PATCH?] Re: Autocorrect for commands with a hyphen (dash) in the name
- Date: Sun, 24 May 2020 22:46:52 -0700
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- In-reply-to: <CAH+w=7bSu-HTLWCAxP2tkLL7uWRxF9FSgggbOyK=jxp1jJt5+Q@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> <CAH+w=7a=AB5ksiU7Tv2A3xnr2TVd=LAfQ--M0B=Vq56T_k+xyA@mail.gmail.com> <22f19bb4707e388629092d2e8673d8294fa8e375.camel@ntlworld.com> <CAH+w=7ar8HHOG-T2EXqwVKTFFPjmrtM0L1XMo90vW+Sed=ESjA@mail.gmail.com> <b20887d9dee281c346812e19b41b22f6d5cd7b97.camel@ntlworld.com> <CAH+w=7a82S7rpnTSZ24MzpXrNWCtRQ1ZpQSxeXvu_Yz4NZig=g@mail.gmail.com> <2d5fcc3630beeec538b7b4dc334991da7420968e.camel@ntlworld.com> <CAH+w=7bSu-HTLWCAxP2tkLL7uWRxF9FSgggbOyK=jxp1jJt5+Q@mail.gmail.com>
> spckword() modifies the original input string in place, to return the
> best guess. In both lex.c and zle_tricky.c, that result string is
> then used in later code, which means if it goes in tokenized it ought
> to come back out that way as well.
Maybe this is just the best way to deal with this mess.
diff --git a/Src/utils.c b/Src/utils.c
index 5158a70..118e132 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3151,8 +3151,12 @@ spckword(char **s, int hist, int cmd, int ask)
if (*t == Tilde || *t == Equals || *t == String)
t++;
for (; *t; t++)
- if (itok(*t))
- return;
+ if (itok(*t)) {
+ if (*t == Dash)
+ *t = '-';
+ else
+ return;
+ }
best = NULL;
for (t = *s; *t; t++)
if (*t == '/')
Messages sorted by:
Reverse Date,
Date,
Thread,
Author