How to know when content rendering is complete

Hi, marijn, I did what you said And for reference, the visual area displays the question article

The following is my code implementation:
Get the starting line number of the viewable area,and set it during initialization

question,Scroll up one line each time the file is reopened。
The first time 23, the second time 22, the third time 21… 。 It seems that my blockInfo is calculated incorrectly, how should I calculate this blockInfo?