I’m writing an app that keeps appending text to a read-only TextArea. (That data is streaming from a running Shell, but that’s not important.) I want the TextArea to keep scrolling as new data is added, but only if the user hasn’t scrolled up. In other words, if the user has moved the scrollbar to the top or middle of the TextArea to read something, I don’t want it suddenly jumping back to the bottom as new data appears. Likewise, if the scrollbar is already at the bottom, I want it to scroll as the new stuff rolls in.
Definitely without plugins (it’s an open-source project) and preferably without declares, how can I tell the relative position of the scrollbar?