Thanks for the partial fix.

Unfortunately there is still something strange going on as the last heading gets hidden. Added some more headings to demonstrate this better:

This is the unfolded file content:

* Heading Lvl 1
** Heading Lvl 2 with VISIBILITY content
:PROPERTIES:
:VISIBILITY: content
:END:
*** Heading Lvl 3
** Another Heading Lvl 2
* Formulas
** New Ones
*** LET
*** LAMBDA
:PROPERTIES:
:VISIBILITY: content
:END:
*** XMATCH
*** XLOOKUP
* Dynamic Array Formulas

After using org-cycle-content followed by org-cycle-set-visibility-according-to-property I get this:

* Heading Lvl 1
** Heading Lvl 2 with VISIBILITY content...
*** Heading Lvl 3...
* Formulas
*** LAMBDA
* Dynamic Array Formulas

Whereas the expected output should look as follows:

* Heading Lvl 1
** Heading Lvl 2 with VISIBILITY content
*** Heading Lvl 3
** Another Heading Lvl 2 (missing)
* Formulas
** New Ones (missing)
*** LET
(missing)
*** LAMBDA
*** XMATCH (missing)
*** XLOOKUP
(missing)
* Dynamic Array Formulas

Setting org-fold-core-style to overlays doesn't change the outcome.

On Wed, Feb 15, 2023 at 4:30 PM Ihor Radchenko <yantar92@posteo.net> wrote:
Daniel Hubmann <hubisan@gmail.com> writes:

> * Heading Lvl 1...** Heading Lvl 2 with VISIBILITY content...
> *** Heading Lvl 3...

Thanks for reporting!
Fixed, on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=be9280f68

--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>