Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: email to zsh

On Jul 6, 10:50am, Peter Stephenson wrote:
} Subject: Re: email to zsh
} Peter Stephenson wrote:
} This seems to fix the problem, and allow the completion to work as
} expected, though I haven't a clue what the code I've fixed is doing.

As best I can tell, ow and w are supposed to bound a region of the
original string (from the command line) that is being added as a match;
add_match_str() sets up the fragment that matched the pattern, and
add_match_sub() sets up the fragment that should be inserted into the
command line to replace it (which in this case is the original text,
so the calls are the same).

sfx indicates whether this is a prefix or suffix match.  In that case
w should be tracking backwards from ow towards the beginning of the
string, otherwise w should be tracking forwards from ow.  At the end
of the inner loop ow = w is assigned, so the only way they ever move
apart is if one of the "continue" statements is hit.

So if you arrive at this point with (sfx && w > ow) || (!sfx && ow > w)
then there has already been an error somewhere else, and all that this
patch will do is mask that error to prevent a crash.

I don't have time right now to look at it any more closely ...

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