pull request

Linus Torvalds torvalds at linux-foundation.org
Mon Aug 20 09:18:39 PDT 2012


On Mon, Aug 20, 2012 at 9:11 AM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> Yes. This is one of those ambiguous cases ("should the group entry be
> selected when *some* of the children are selected, and some are
> unselected"), and the reason I picked the solution I picked is that it
> gets the common case of "single contiguous selection-by-date" right.

Btw, it isn't the *only* choice that gets it right. I could have made
the rule be:

 - Select the group entry *if* the whole group is selected *or* if the
first entry of that group *and* the last entry of the previous group
are selected.

There are possibly other similar rules that migth make sense.

But the "select the group entry by default iff the first dive in the
group is selected" was the simplest algorithm that gets the expected
pattern.

Btw, this particular ambiguity only comes up when moving from non-date
view to date view. Normally, the group entry selection is under
control of the user (with the caveat that collapsing a group with
active dives *has* to select the group entry, and that entry will stay
selected when expanding it again), and I tried to make sure that all
our selection rules did minimal possible "damage" to user selections.

So if somebody selects all dives under a group, but doesn't select the
group entry itself, that's fine. The selection logic doesn't try to
second-guess what the user wants. It's only when it moves from
non-grouped view to grouped view that it simply has to make *some*
choice.

If you can find other special cases, holler.

                Linus


More information about the subsurface mailing list