[libcalamaresui] Try to improve 'tailing' experience

This commit is contained in:
Adriaan de Groot 2022-03-15 14:02:24 +01:00
parent 1a3f41ff33
commit d998c9e24b

View File

@ -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();
}