gui: fix scrolling in chat and message input

- Restore ScrollView for message input to enable overflow scrolling
- Remove manual wheel handlers that broke ListView virtualization
- Let wheel events propagate naturally to ListView
This commit is contained in:
Levi Neely 2026-08-07 11:20:13 +02:00
parent df8e69aeb8
commit 2ea6ec1ba7
1 changed files with 36 additions and 37 deletions

View File

@ -1428,14 +1428,6 @@ property bool blockExpanded: {
chatView.interactive = true chatView.interactive = true
mouse.accepted = false mouse.accepted = false
} }
onWheel: function(wheel) {
// Always allow wheel scrolling, even during selection
chatView.contentY = Math.max(0, Math.min(
chatView.contentHeight - chatView.height,
chatView.contentY - wheel.angleDelta.y
))
wheel.accepted = true
}
} }
// Context menu (right button) - separate to avoid deselection // Context menu (right button) - separate to avoid deselection
@ -1461,49 +1453,56 @@ property bool blockExpanded: {
Layout.margins: 6 Layout.margins: 6
spacing: 4 spacing: 4
// TextArea without ScrollView - wheel scrolls when content overflows // TextArea in ScrollView for overflow, with context menu overlay
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumHeight: 200 Layout.maximumHeight: 200
Layout.preferredHeight: Math.min(promptInput.contentHeight + 16, 200) Layout.preferredHeight: Math.min(promptInput.contentHeight + 16, 200)
clip: true
TextArea { ScrollView {
id: promptInput id: promptScroll
anchors.fill: parent anchors.fill: parent
placeholderText: { ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
if (!ollie.daemonConnected) return "Not connected"
if (!ollie.activeSessionId) return "No session" TextArea {
if (!ollie.activeAgentId) return "No agent" id: promptInput
if (ollie.isSessionPaused(ollie.activeSessionId)) return "Session paused" width: promptScroll.width
return "Message..." placeholderText: {
} if (!ollie.daemonConnected) return "Not connected"
enabled: ollie.daemonConnected && ollie.activeSessionId !== "" && ollie.activeAgentId !== "" && !ollie.isSessionPaused(ollie.activeSessionId) if (!ollie.activeSessionId) return "No session"
wrapMode: TextEdit.Wrap if (!ollie.activeAgentId) return "No agent"
selectByMouse: true if (ollie.isSessionPaused(ollie.activeSessionId)) return "Session paused"
persistentSelection: true return "Message..."
}
enabled: ollie.daemonConnected && ollie.activeSessionId !== "" && ollie.activeAgentId !== "" && !ollie.isSessionPaused(ollie.activeSessionId)
wrapMode: TextEdit.Wrap
selectByMouse: true
persistentSelection: true
property string _lastText: "" property string _lastText: ""
property int _lastCursorPos: 0 property int _lastCursorPos: 0
onTextChanged: { onTextChanged: {
_lastText = text _lastText = text
_lastCursorPos = cursorPosition _lastCursorPos = cursorPosition
} }
Keys.onReturnPressed: function(event) { Keys.onReturnPressed: function(event) {
if (event.modifiers & Qt.ShiftModifier) { if (event.modifiers & Qt.ShiftModifier) {
event.accepted = false event.accepted = false
} else { } else {
if (text.trim() !== "") { if (text.trim() !== "") {
ollie.submit(text.trim()) ollie.submit(text.trim())
text = "" text = ""
}
event.accepted = true
} }
event.accepted = true
} }
} }
} }
// Context menu overlay - only catches right-click // Context menu overlay - only catches right-click, on top of ScrollView
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton