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



On Sat, 2020-05-23 at 12:54 -0700, Bart Schaefer wrote:
> On Sat, May 23, 2020 at 12:45 PM Peter Stephenson
> <p.w.stephenson@xxxxxxxxxxxx> wrote:
> > 
> > On Sat, 2020-05-23 at 12:33 -0700, Bart Schaefer wrote:
> > > [Moving to -workers from -users]
> > > 
> > > On Tue, May 19, 2020 at 2:25 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> > > > 
> > > > So, the following?  Or should this also have the equivalent of
> > > > 
> > > >             if (*w == Tilde || *w == Equals || *w == String)
> > > >                 *x = *w;
> > > 
> > > Any comment on this?
> > 
> > I don't think you need to put back tokens.
> 
> Good point.
> 
> What about the special handling for Tilde et al?  That precedes the
> spckword() call in zle_tricky.c

Yes, I guess you need to skip over those before untokenizing.  That matches
this line in spckword():

    if (*t == Tilde || *t == Equals || *t == String)
	t++;

The next block is then skipping other tokens.  I wonder if that
would be the right place to put the surgery?  E.g. if thereʼs
a Dash or anything else we want to be able to treat literally, dupstring
at that point within spckword() and replace those?

However, thatʼs late enough that itʼs past the point where we check the
word isnʼt already found in a hash table --- and presumably we need at
least to have the dashes fixed by that point.  But still not sure we
actually need two separate token-based interventions.

pws



Messages sorted by: Reverse Date, Date, Thread, Author