pull request

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


On Mon, Aug 20, 2012 at 8:36 AM, Dirk Hohndel <dirk at hohndel.org> wrote:
>
> If I sort by something else and select some dives, including one that is
> a last dive of a dive group (i.e., the first dive that shows up below the
> summary entry), then after switching back the group summary entry is
> selected. See here for example:

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.

IOW, do a contiguous selection of dives by date (but not at group
boundaries), and collapse/expand the dates and/or shift to some other
sort order and back, and in order for the selection to *stay*
contiguous, the "group entry is selected" choice needs to basically be
the same as "first entry in the group is selected".

If you have a random (non-date-contiguous) group of dives selected,
then that "first dive in group decides whether the group is selected
or not" choice will result in somewhat odd pattern, but I felt that
since the selection pattern in that case is random *anyway*, that
doesn't matter as much as the case of having the common
date-contiguous selections.

But yes, the choice is ambiguous, and there are other possible
algorithms to decide whether a group entry should be selected or not.

Anyway, right now the rules are (or should be - maybe I missed something):

 - a *collapsed* group is selected if any of the dives within it are selected

   This is important for two reasons:
    (a) visual clue that there is something selected
    (b) if we don't do this, then we hit the gtk "out of sight, out of
mind" problem, where gtk doesn't know or care about the (hidden)
selected dives, and then if we select something else, gtk will never
give us a un-selection notice about the hidden dives.

 - an *expanded* group is selected by default if the first dive in the
group is selected.

   This gives us that visually nice contiguous selection for
contiguous dive selections (otherwise we might have the last
partly-selected group entry unselected because there are unselected
entries in that group, or we might have the first group entry selected
even though the first few dives in that group are unselected).

But notice the "by default" about the second rule (the first rule
*should* be a hard rule). If the group is expanded, you can obviously
do selection things on the entries in the group, and if you unselect
the first dive, that will not then magically unselect the group. So
with an expanded group, the user can override the default behavior,
exactly *because* the group is expanded.

So I agree that the selection behavior for group entries may not
necessarily be "obvious", but I claim that there's at least some
reason for the choices I made.

Modulo bugs, of course. Always modulo bugs.

             Linus


More information about the subsurface mailing list