From e3ad60911d4483dbc9af6a839f97c23c9fa1dae3 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 23 Oct 2023 01:56:53 +0200 Subject: [PATCH] Fix scroll position jumping when replying or resizing the window --- resources/qml/MessageView.qml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index 98b9748a..df39f3d1 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -59,6 +59,13 @@ Item { spacing: 2 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 { id: defaultMessageStyle