help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: PATCH: Fix inverted condition for unique completions
Date: Thu, 17 Mar 2022 20:32:49 +0100	[thread overview]
Message-ID: <CAHYJk3QcMJ+cyoKBAbZqT1xE-LFmyT9yBaE==zmkiKymE-5MFw@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7ZNOqLqHn3RoC+OcDOY=kYkV=AnWLmYM04jtjNauUa62A@mail.gmail.com>

On 3/17/22, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Thu, Mar 17, 2022 at 10:09 AM Mikael Magnusson <mikachu@gmail.com>
> 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

  reply	other threads:[~2022-03-17 19:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15 11:56 Mikael Magnusson
2022-03-17 17:08 ` Mikael Magnusson
2022-03-17 19:17   ` Bart Schaefer
2022-03-17 19:32     ` Mikael Magnusson [this message]
2022-03-26  1:40       ` PATCH 1/2: Fix comments for UNIQCON/ALL Mikael Magnusson
2022-03-26  1:43         ` PATCH 2/2: [WIP] Efficient dedup for unsorted completions Mikael Magnusson
2022-03-29 16:07           ` PATCHv2 2/2: " Mikael Magnusson
2022-03-30 16:41           ` PATCH 2/2: [WIP] " Bart Schaefer
2022-03-30 18:33             ` Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHYJk3QcMJ+cyoKBAbZqT1xE-LFmyT9yBaE==zmkiKymE-5MFw@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).