From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 6971 invoked from network); 19 May 2020 21:26:19 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 19 May 2020 21:26:19 -0000 Received: (qmail 5032 invoked by alias); 19 May 2020 21:26:09 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24860 Received: (qmail 19943 invoked by uid 1010); 19 May 2020 21:26:09 -0000 X-Qmail-Scanner-Diagnostics: from mail-oi1-f179.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25814. spamassassin: 3.4.4. Clear:RC:0(209.85.167.179):SA:0(-1.9/5.0):. Processed in 2.730365 secs); 19 May 2020 21:26:09 -0000 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.167.179 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=CeN/CdpSociM7k7ViWjxqWFuBr2FVQFjEEf47Lmc29Y=; b=GPHmB8XZcvRn+gTogZC6eQst8n0Qp2OdyTYQ521fTSaIkg3a/c6f8pSnRLM+fTTKYi GbYR43k+vQxDeoWEd6Mqr5x8B0f0A/hgmPZkjGrmXpIfjpQg9c8VD469vyQMsumBRlMi Eq9sq242ASy4Dsvh+zH1A78tk3+yi4wxTVdUQa7BBpAqRtd0o584O5L6FpE8ivsaEJok wF9s80eMu2k3WIY/0Cj24dMgx5pJrjZv1mKM6ao7r2lxGspZZX+9O7OiyYm4+46w+k+i BI7Xo4ejjEu+wj1YLV/odbNe7N2XTAmrJbs8tHU4gENQqY4KF609JiAph/eJUQhJOMj1 0puA== X-Gm-Message-State: AOAM5336k5+mdKthZSU7ux/bP7To4J1d16U3+aOjZjlqUFvjqG1Qz2Us JP9xhdpHUaFnVIvD/u2svt7gd0agAFyCVC2VTngf0nAyxGRJCg== X-Google-Smtp-Source: ABdhPJzfzROh7iyYjF5jbJM5Iyjr5/exeRLiHAAESZzNucwShAgBbwqwu6juTfLWwdzaJIUV8ZgBBxhiNpYR451C89U= X-Received: by 2002:a54:4601:: with SMTP id p1mr1043289oip.173.1589923532366; Tue, 19 May 2020 14:25:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Tue, 19 May 2020 14:25:21 -0700 Message-ID: Subject: Re: Autocorrect for commands with a hyphen (dash) in the name To: Daniel Shahaf Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, May 18, 2020 at 5:53 PM Daniel Shahaf wrot= e: > > 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 =C2=ABisset(CORRECT)=C2=BB 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 =3D=3D Tilde || *w =3D=3D Equals || *w =3D=3D String) *x =3D *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 <=3D 0 && tok =3D=3D STRING && !nocorrect && !(inbufflags & INP_ALIAS) && - (isset(CORRECTALL) || (isset(CORRECT) && incmdpos))) - spckword(&tokstr, 1, incmdpos, 1); + (isset(CORRECTALL) || (isset(CORRECT) && incmdpos))) { + char *x =3D dupstring(tokstr); + untokenize(x); + spckword(&x, 1, incmdpos, 1); + tokenize(tokstr =3D x); + } if (!tokstr) { zshlextext =3D tokstrings[tok];