Skip to content

Commit

Permalink
Suppress scrollToBottom on CompileOutput after navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
arBmind committed Jul 10, 2021
1 parent aa62b39 commit ed599fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/plugins/coreplugin/outputwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ OutputWindow::OutputWindow(Context context, const QString &settingsKey, QWidget
d->scrollTimer.setInterval(10);
d->scrollTimer.setSingleShot(true);
connect(&d->scrollTimer, &QTimer::timeout,
this, &OutputWindow::scrollToBottom);
this, [&]() {
if (d->scrollToBottom) { scrollToBottom(); }
});
d->lastMessage.start();

d->originalFontSize = font().pointSizeF();
Expand Down Expand Up @@ -347,6 +349,11 @@ void OutputWindow::updateFilterProperties(
filterNewContent();
}

void OutputWindow::disableScrollToBottom()
{
d->scrollToBottom = false;
}

void OutputWindow::filterNewContent()
{
QTextBlock lastBlock = document()->findBlockByNumber(d->lastFilteredBlockNumber);
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/coreplugin/outputwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ class CORE_EXPORT OutputWindow : public QPlainTextEdit
bool regexp,
bool isInverted);

void disableScrollToBottom();

signals:
void wheelZoom();

Expand Down
4 changes: 4 additions & 0 deletions src/plugins/projectexplorer/compileoutputwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ void CompileOutputWindow::goToNext()
m_outputWindow->setTextCursor(cursor);
cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
m_outputWindow->setTextCursor(cursor);
m_outputWindow->disableScrollToBottom();
}

void CompileOutputWindow::goToPrev()
Expand All @@ -278,6 +279,7 @@ void CompileOutputWindow::goToPrev()
m_outputWindow->setTextCursor(cursor);
cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
m_outputWindow->setTextCursor(cursor);
m_outputWindow->disableScrollToBottom();
}

bool CompileOutputWindow::canNavigate() const
Expand Down Expand Up @@ -329,6 +331,7 @@ void CompileOutputWindow::showPositionOf(const Task &task)

// Center cursor now:
m_outputWindow->centerCursor();
m_outputWindow->disableScrollToBottom();
}

void CompileOutputWindow::scrollToFirstTask()
Expand All @@ -342,6 +345,7 @@ void CompileOutputWindow::scrollToFirstTask()
m_outputWindow->setTextCursor(cursor);
cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
m_outputWindow->setTextCursor(cursor);
m_outputWindow->disableScrollToBottom();
}

void CompileOutputWindow::flush()
Expand Down

0 comments on commit ed599fd

Please sign in to comment.