Finding the uppermost row that is visible


Say there are 100 lines in the document, and the user is currently looking at lines 50-100 (they’ve scrolled to the bottom), how do I find this row index (50)? It’s not “screen coordinates” that I’m after, because they don’t take into account scrolling, just word wrap and line folding.


I don’t know if there’s a way of finding the scroll position of the TextEditor.