Ah, yes, what you’re seeing there looks like the editor’s state getting screwed up by the recursive calls originating from the event handler. The manual states you aren’t allowed to “try to change the state of the editor” from this event, and due to the way rendering and measuring works, calling cursorCoords
can change the editor’s state.
In general, you seem to be heading down a route of madness here. Measuring requires a rendered representation of a line, so measuring a given line when it is being rendered is, even if it wouldn’t crash your editor, going to duplicate all rendering work. Have you considered just measuring the size of a space, once, and using that and hoping for the best? Or are you really using widgets in leading whitespace and/or wildly varying font sizes?