From d998c9e24ba2a25be14fdd4845cbe0308d1ee49f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 15 Mar 2022 14:02:24 +0100 Subject: [PATCH] [libcalamaresui] Try to improve 'tailing' experience --- src/libcalamaresui/widgets/LogWidget.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libcalamaresui/widgets/LogWidget.cpp b/src/libcalamaresui/widgets/LogWidget.cpp index 8e559be7d..7d81e0ca0 100644 --- a/src/libcalamaresui/widgets/LogWidget.cpp +++ b/src/libcalamaresui/widgets/LogWidget.cpp @@ -77,8 +77,14 @@ LogWidget::LogWidget( QWidget* parent ) void LogWidget::handleLogChunk( const QString& logChunk ) { + // Scroll to the end of the new chunk, only if we were at the end (tailing + // the log); scrolling up will break the tail-to-end behavior. + const bool isAtEnd = m_text->textCursor().atEnd(); m_text->appendPlainText( logChunk ); - m_text->moveCursor( QTextCursor::End ); + if ( isAtEnd ) + { + m_text->moveCursor( QTextCursor::End ); + } m_text->ensureCursorVisible(); }