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 16887 invoked from network); 25 May 2020 05:47:51 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 25 May 2020 05:47:51 -0000 Received: (qmail 21463 invoked by alias); 25 May 2020 05:47:38 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45910 Received: (qmail 24523 invoked by uid 1010); 25 May 2020 05:47:38 -0000 X-Qmail-Scanner-Diagnostics: from mail-ot1-f50.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25821. spamassassin: 3.4.4. Clear:RC:0(209.85.210.50):SA:0(-1.9/5.0):. Processed in 1.685127 secs); 25 May 2020 05:47:38 -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.210.50 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; bh=QihmAtvtybee0kHEIZyP2U1oYf2m840G8q3/ZRJAvvI=; b=J8EFwj6WSkcxcEyBnvKiqxvDNoinqIOM0Na7AKbksbwVD3TSa6qKmWHqZ/XSmy+n9C untprmir02BPF1cldEYIzKpZcjS6Uqu6k1+HCTyx6fVOoZfRNPN892qDiQtHZgrF/+je lh7rcEmujhdmMI+xxa4fcKzcI0V4tfKwa9V53zSPwIXOXpXVpIPlYaYTyjyK7l7Bg8Zv FLds1BGbStEFGZJN6bt1p0SjA8npxKnjo5QMdhMSDk1TevfRKj3dlazdcDpOBRHKtpdz wzbrP2HO6G0fT2MunBddPUGp9/sr7RuI3r5+q0azq4vicTKLwGuKV7rMD/jJocFBKOki L7Fg== X-Gm-Message-State: AOAM532LzqIflCCzbh/njnteXAvy9hxhFFHmu2KVUhlZVk832miotgCo zZln0MwjTBKoJKk1VUwzbQ4/kqIA2A95ujKp3HjKWA== X-Google-Smtp-Source: ABdhPJxnRSDAbgT8k09iaPX76x8hWmTt5+de1/XQ0+lyFlCLwtmoVvTyKxvRHMkeOECtU/WH6PvAW6QofxVFCoHjXtM= X-Received: by 2002:a9d:20e7:: with SMTP id x94mr21189435ota.260.1590385623037; Sun, 24 May 2020 22:47:03 -0700 (PDT) MIME-Version: 1.0 References: <22f19bb4707e388629092d2e8673d8294fa8e375.camel@ntlworld.com> <2d5fcc3630beeec538b7b4dc334991da7420968e.camel@ntlworld.com> In-Reply-To: From: Bart Schaefer Date: Sun, 24 May 2020 22:46:52 -0700 Message-ID: Subject: Re: [PATCH?] Re: Autocorrect for commands with a hyphen (dash) in the name To: Peter Stephenson Cc: "zsh-workers@zsh.org" Content-Type: text/plain; charset="UTF-8" > 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 == '/')