Sublime Forum

Preserve sub-foldings on any level when folding/unfolding the mother ones

#1

I need to preserve the sub-foldings on folding/unfolding the mother (super) ones.

Kindly find this Illustrative Example that will help you understand what I mean.

0 Likes

#2
0 Likes

#3

Is there a currently developed plugin/solution for that?

0 Likes

#4

I don’t think it’s really possible, there’s no API event to detect when a region is being folded or unfolded (via the view.fold view.unfold API), so unless the plugin would be the only one used to fold and unfold (such that it can guarantee the fold state itself), then there is no way to refold inner regions when the outer region is unfolded.

0 Likes

#5

Just wanted to point out, that some of the recent relases has added the view.is_folded(region) and view.folded_regions() methods. (They are not in the doc yet, but in sublime.py.)

So it should not be so problematic to hook into fold/unfold, invisible mark these regions (via view.add_region) while folding and refold them while unfolding.

0 Likes