I'm trying to write something to the terminal and later delete it. So I need to keep track of the first character's cursor position. But since there may be scrolling inbetween, I need to account for viewport shifts and maybe even buffer shifts.
So far I sent \u001B[6n to get the cursor viewport position. Is there a way to get the buffer position or get events when the viewport of buffer change?