From e965e1680f6850a75963a760305c3ca99e4094a0 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 16 Jan 2026 17:07:03 -0500 Subject: [PATCH] Add hack around atYEnd This fixes the annoying "I just scrolled down to the bottom, how come NeoChat doesn't think I did?" From what I can tell this is also ListView bug (or something caused by our style/Kirigami) that creates cases like contentY being -643.2 (for a ListView of height 643) thus that's not "at Y's end". For our case though, we don't care and can safely round it. (cherry picked from commit 3c77711417c2c4e02fcea09507b56714809465be) --- src/timeline/TimelineView.qml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/timeline/TimelineView.qml b/src/timeline/TimelineView.qml index 591aef1c9..24677e75c 100644 --- a/src/timeline/TimelineView.qml +++ b/src/timeline/TimelineView.qml @@ -88,6 +88,9 @@ QQC2.ScrollView { ListView { id: messageListView + // HACK: Use this instead of atYEnd to handle cases like -643.2 at height of 643 not being counted as "at the beginning" + readonly property bool closeToYEnd: -Math.round(contentY) >= height + /** * @brief Whether all unread messages in the timeline are visible. */ @@ -135,7 +138,7 @@ QQC2.ScrollView { Shortcut { sequences: [ StandardKey.Cancel ] onActivated: { - if (!messageListView.atYEnd || !_private.room.partiallyReadStats.empty()) { + if (!messageListView.closeToYEnd || !_private.room.partiallyReadStats.empty()) { messageListView.positionViewAtBeginning(); } else { (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).get(0).forceActiveFocus(); @@ -184,12 +187,12 @@ QQC2.ScrollView { } } - onAtYEndChanged: if (atYEnd && _private.hasScrolledUpBefore) { + onCloseToYEndChanged: if (closeToYEnd && _private.hasScrolledUpBefore) { if (QQC2.ApplicationWindow.window && (QQC2.ApplicationWindow.window.visibility !== QQC2.ApplicationWindow.Hidden)) { _private.room.markAllMessagesAsRead(); } _private.hasScrolledUpBefore = false; - } else if (!atYEnd) { + } else if (!closeToYEnd) { _private.hasScrolledUpBefore = true; } @@ -245,7 +248,7 @@ QQC2.ScrollView { padding: Kirigami.Units.largeSpacing z: 2 - visible: !messageListView.atYEnd + visible: !messageListView.closeToYEnd text: i18nc("@action:button", "Jump to latest message")