diff --git a/gui/main.qml b/gui/main.qml index 2a83f01..31812f4 100644 --- a/gui/main.qml +++ b/gui/main.qml @@ -467,7 +467,6 @@ ApplicationWindow { chatModel.trimFront(20) } } - // Ensure we have the latest session list ollie.refreshSessions() buildSessionTree() } @@ -476,7 +475,7 @@ ApplicationWindow { target: ollie function onActiveSessionIdChanged() { chatModel.reset() - chatView.shouldAutoScroll = true // Reset scroll state on session switch + chatView.followTail = true if (ollie.activeSessionId && ollie.activeAgentId) { var log = ollie.readLogForSession(ollie.activeSessionId, ollie.activeAgentId) if (log) { @@ -487,7 +486,7 @@ ApplicationWindow { } function onActiveAgentIdChanged() { chatModel.reset() - chatView.shouldAutoScroll = true // Reset scroll state on agent switch + chatView.followTail = true if (ollie.activeSessionId && ollie.activeAgentId) { var log = ollie.readLogForSession(ollie.activeSessionId, ollie.activeAgentId) if (log) { @@ -883,21 +882,18 @@ ApplicationWindow { boundsBehavior: Flickable.StopAtBounds visible: ollie.daemonConnected && ollie.activeAgentId !== "" - // Auto-scroll state: true = follow new content, false = user scrolled up - property bool shouldAutoScroll: true + property bool followTail: true + property bool scrollingNow: false onContentHeightChanged: { - // Content grew — scroll to end if we're following - if (shouldAutoScroll && contentHeight > height) { + if (followTail && !scrollingNow && contentHeight > 0) { + scrollingNow = true positionViewAtEnd() + scrollingNow = false } } - onMovementEnded: { - // User finished scrolling — update auto-scroll based on position - // atYEnd is true when scrolled to bottom - shouldAutoScroll = atYEnd - } + onMovementEnded: followTail = atYEnd delegate: ChatBlockDelegate { width: chatView.width - 8