fix scroll height and prose line breaks in rich output

- Loader delegate: set explicit height from item.implicitHeight so
  ListView can calculate correct contentHeight for scrolling
- Prose sub-blocks: escape HTML, convert newlines to <br> before
  linkifying paths (RichText ignores bare newlines)
This commit is contained in:
Levi Neely 2026-07-16 06:36:00 +02:00
parent 9e10bf30db
commit 0783c7dda3
1 changed files with 7 additions and 1 deletions

View File

@ -393,6 +393,7 @@ ApplicationWindow {
delegate: Loader {
width: chatList.width
height: item ? item.implicitHeight : 0
property var block: model
sourceComponent: {
switch (blockType) {
@ -499,8 +500,13 @@ ApplicationWindow {
// --- Chat block delegates ---
function linkifyPaths(text) {
// Escape HTML entities first
let escaped = text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
// Convert newlines to <br>
escaped = escaped.replace(/\n/g, '<br>')
// Match /absolute/path or /absolute/path:line
return text.replace(/(\/[\w\-.\/]+(?::\d+)?)/g, '<a href="file://$1">$1</a>')
escaped = escaped.replace(/(\/[\w\-.\/]+(?::\d+)?)/g, '<a href="file://$1">$1</a>')
return escaped
}
Component {