Fix scroll position jumping when replying or resizing the window

This commit is contained in:
Nicolas Werner 2023-10-23 01:56:53 +02:00
parent d45dc6c77b
commit e3ad60911d
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -59,6 +59,13 @@ Item {
spacing: 2 spacing: 2
verticalLayoutDirection: ListView.BottomToTop verticalLayoutDirection: ListView.BottomToTop
property int lastScrollPos: 0
// Fixup the scroll position when the height changes. Without this, the view is kept around the center of the currently visible content, while we usually want to stick to the bottom.
onMovementEnded: lastScrollPos = (contentY+height)
onModelChanged: lastScrollPos = (contentY+height)
onHeightChanged: contentY = (lastScrollPos-height)
Component { Component {
id: defaultMessageStyle id: defaultMessageStyle