Stay at bottom when we're at bottom and new messages arrive.

Authored by dfaure on Jun 10 2019, 4:00 PM.

Description

Stay at bottom when we're at bottom and new messages arrive.

Summary:
The method positionViewAtEnd() does exactly that, and if we call
it when the content height changed, then rendering has happened, unlike
in onCountChanged which is too early.

While at it do the right thing: if we have scrolled up to read old
messages, then don't force-scroll-down, only if we were indeed at the
bottom already.

This points to a separate issue where the Y position is jumping around
while we're scrolling up and down (in fact because contentHeight
changes, too). I suspect it's because items are loaded on demand.
But anyway it's a separate issue.

Test Plan:
Talking to myself in a chat, all my new messages
appear correctly. Talking to a bot, if I scroll up fast enough then
the bot's reply doesn't make the view scroll down.

Reviewers: mlaurent

Reviewed By: mlaurent

Subscribers: Ruqola

Differential Revision: https://phabricator.kde.org/D21726

Details