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

Re: PATCH: Fix inverted condition for unique completions



On 3/17/22, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Thu, Mar 17, 2022 at 10:09 AM Mikael Magnusson <mikachu@xxxxxxxxx>
> wrote:
>>
>> Okay, so UNIQALL means to remove only consecutive duplicates, and
>> UNIQCON means keep all duplicates. Right. That doesn't make any sense,
>> but it does match what the original code does (I think).
>
> I suppose it depends on what CON is supposed to mean.  I think the
> meaning is to collapse only consecutive duplicates down to one
> occurrence, so duplicates with intervening non-duplicates may still be
> left.  E.g., similar to the difference between "sort -u" (UNIQALL) and
> "uniq" (UNIQCON).

Yeah, testing shows that one of the options keeps all duplicates and
the other keeps non-consecutive duplicates, while the default is to
remove all duplicates. I think the reason it's only noticably slow
when sorting by file date is that when the completion code sorts by
name, the deduplication algorithm is fairly linear. All the confusion
stems from the fact that the comments say the exact opposite of what
the code does and is documented to do :).

>> With that in mind, I have the following patch instead, any objections
>> to this?
>
> I don't immediately see any problem with it, unless my remark above
> changes your understanding somehow.
>
>> PS the manpage says -V is required for -1/-2 but -J with -o nosort
>> works as well which is what happens below.
>
> That makes some sense, yes.


-- 
Mikael Magnusson




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