From: Bart Schaefer <schaefer@brasslantern.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Autocorrect for commands with a hyphen (dash) in the name
Date: Tue, 19 May 2020 14:25:21 -0700 [thread overview]
Message-ID: <CAH+w=7aqAO37qpSvtmJXMPWq3zP=pUAZCe3i-BFyn0knRmFjVQ@mail.gmail.com> (raw)
In-Reply-To: <ab8b7655-83e8-45b2-889f-043314faea62@www.fastmail.com>
On Mon, May 18, 2020 at 5:53 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>
> Bart Schaefer wrote on Tue, 19 May 2020 00:38 +00:00:
> > Autocorrect isn't really a spelling checker
>
> I think there may be more to it than that. spckword() expects its first
> argument, *s, to be unmetafied; however, when that function is called
> from the «isset(CORRECT)» codepath, *s is metafied.
Ahh, another side-effect of the decision to metafy hyphens.
So, the following? Or should this also have the equivalent of
if (*w == Tilde || *w == Equals || *w == String)
*x = *w;
like zle_tricky.c?
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];
prev parent reply other threads:[~2020-05-19 21:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 0:15 Seth Tisue
2020-05-19 0:38 ` Bart Schaefer
2020-05-19 0:52 ` Daniel Shahaf
2020-05-19 21:25 ` Bart Schaefer [this message]
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=7aqAO37qpSvtmJXMPWq3zP=pUAZCe3i-BFyn0knRmFjVQ@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=d.s@daniel.shahaf.name \
--cc=zsh-users@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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).