closestCommonParentFold now works in both directions.

Before, closestCommonParentFold, when one fold was a
child of the other, only reported correctly if the first fold
passed to it was a child of the second fold. The other way
around would report no common parent.

We now also run the check inverted to catch that case.
When removing the folded attribute, remove it from open child folds.

Before, while trying not to open folds that were closed and
whose depth wasn’t high enough to requested unfold level,
we forgot to unmark child folds that were deeper than the
requested unfold level, but were open to begin with and
therefore shouldn’t appear collapsed anyway.
Fix an off-by-one error in the forward continuity scan on fold open.

We fixed this in fold closing as well, and I thought I’d already
gotten it in fold opening, but apparently not.
Fix direction of depth comparison when deciding whether to stop opening.

We now scan forward until we reach a fold with a common
parent whose depth is below that of the fold we’re opening,
which indicates that we’ve exceeded the range of the fold
we’re opening.