[education/labplot] src/frontend/script: [scripting] convert line breaks with <br> html tags.
Alexander Semke <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit dd49fc4f6ad234c821bd6830aca9a62ceced9398 by Alexander Semke.
Committed on 28/07/2026 at 14:43.
Pushed by asemke into branch 'master'.
[scripting] convert line breaks with <br> html tags.
M +6 -0 src/frontend/script/ScriptEditor.cpp
https://invent.kde.org/education/labplot/-/commit/dd49fc4f6ad234c821bd6830aca9a62ceced9398
diff --git a/src/frontend/script/ScriptEditor.cpp b/src/frontend/script/ScriptEditor.cpp
index 8c30e3553b..dc2026381e 100644
--- a/src/frontend/script/ScriptEditor.cpp
+++ b/src/frontend/script/ScriptEditor.cpp
@@ -144,6 +144,9 @@ void ScriptEditor::writeOutput(bool isErr, const QString& msg) {
cursor.movePosition(QTextCursor::End);
ui.output->setTextCursor(cursor);
ui.output->insertHtml(processedHtml);
+
+ // Ensure we scroll to the bottom
+ ui.output->ensureCursorVisible();
}
void ScriptEditor::setSplitterState(const QByteArray& state) {
@@ -234,6 +237,9 @@ QString ScriptEditor::processOutputText(bool isErr, const QString& text) {
// Now escape HTML
QString processedText = text.toHtmlEscaped();
+ // Convert newlines to <br> tags for proper line breaks in HTML
+ processedText.replace(QLatin1String("\n"), QLatin1String("<br>"));
+
// Replace matches in reverse order to preserve positions
for (int i = matches.size() - 1; i >= 0; --i) {
const LineMatch& lm = matches[i];