TAdvMemo Code folding

Hello,

I have enabled CodeFolding in my TAdvMemo. Given the current active line, do you know how to get the begin and end line of the current node that holds this active line.
 In other words, given a line number in TAdvMemo, how can I find the begin and end line of the code block that this line belongs to?

Thanks,

AdvMemo.IsNode() returns whether a line has a node.

AdvMemo.IsLastChild() returns whether a line is the last child line of a node.
So, when you find a node, loop the next lines till you find IsLastChild()

Thank you