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:
parent
24edd5941a
commit
a0f71a01c2
12
gui/main.qml
12
gui/main.qml
|
|
@ -444,13 +444,22 @@ ApplicationWindow {
|
|||
Layout.margins: 6
|
||||
spacing: 4
|
||||
|
||||
ScrollView {
|
||||
Layout.fillWidth: true
|
||||
Layout.maximumHeight: 200
|
||||
Layout.preferredHeight: Math.min(promptInput.contentHeight + 16, 200)
|
||||
clip: true
|
||||
|
||||
TextArea {
|
||||
id: promptInput
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: font.pointSize * 5 + 16
|
||||
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
|
||||
|
|
@ -467,3 +476,4 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue