gui: wrap prompt input in ScrollView for scrollable multi-line text area

- TextArea grows from 5 rows up to 200px as content increases
- Auto-scrolls to bottom on text change
- Uses Math.min(contentHeight, max) to avoid unnecessary space
This commit is contained in:
Levi Neely 2026-08-01 11:39:21 +02:00
parent 24edd5941a
commit a0f71a01c2
1 changed files with 24 additions and 14 deletions

View File

@ -444,22 +444,32 @@ ApplicationWindow {
Layout.margins: 6
spacing: 4
TextArea {
id: promptInput
ScrollView {
Layout.fillWidth: true
Layout.preferredHeight: font.pointSize * 5 + 16
placeholderText: ollie.activeSessionId ? "Message..." : "No session"
enabled: ollie.activeSessionId !== ""
wrapMode: TextEdit.Wrap
Keys.onReturnPressed: {
if (event.modifiers & Qt.ShiftModifier) {
event.accepted = false
} else {
if (text.trim() !== "") {
ollie.submit(text.trim())
text = ""
Layout.maximumHeight: 200
Layout.preferredHeight: Math.min(promptInput.contentHeight + 16, 200)
clip: true
TextArea {
id: promptInput
Layout.fillWidth: true
placeholderText: ollie.activeSessionId ? "Message..." : "No session"
enabled: ollie.activeSessionId !== ""
wrapMode: TextEdit.Wrap
onTextChanged: {
// Auto-scroll to bottom as content grows
textCursor.position = text.length
}
Keys.onReturnPressed: {
if (event.modifiers & Qt.ShiftModifier) {
event.accepted = false
} else {
if (text.trim() !== "") {
ollie.submit(text.trim())
text = ""
}
event.accepted = true
}
event.accepted = true
}
}
}