@Edson: That would not work for him.
He knows, the block ended (in the previous line) when he finds a line that starts with "fpcup".
If he closed the fold that line, then that line will be part of the fold, and be hidden. [1] He does not want that.
Of course he could have a peek on the next line, when he finishes scanning a line. But that would NOT work (or only if the text is never edited). Because if the next line was edited, the peeked info may become wrong, but would not be updated.
----------
[1]
At current there is a hack, that deals with
end else begin
excluding the end.
Not sure where that is, but IIRC not where it should be.
----------------
Another way, that may work: the HL has a method to return the length in lines of a block.
It may be possible (but not tested) to close in the "fpcup" line, and adjust the fold length/line count....