Skip to content
Snippets Groups Projects
Commit 3023495c authored by hjk's avatar hjk
Browse files

debugger: don't keep scrolling to the end if the user manually moved the

cursor
parent d29b5cd2
No related branches found
No related tags found
No related merge requests found
...@@ -341,6 +341,10 @@ void DebuggerOutputWindow::showOutput(int channel, const QString &output) ...@@ -341,6 +341,10 @@ void DebuggerOutputWindow::showOutput(int channel, const QString &output)
{ {
if (output.isEmpty()) if (output.isEmpty())
return; return;
QTextCursor oldCursor = m_combinedText->textCursor();
QTextCursor cursor = oldCursor;
cursor.movePosition(QTextCursor::End);
bool atEnd = oldCursor.position() == cursor.position();
foreach (QString line, output.split('\n')) { foreach (QString line, output.split('\n')) {
// FIXME: QTextEdit asserts on really long lines... // FIXME: QTextEdit asserts on really long lines...
const int n = 30000; const int n = 30000;
...@@ -349,10 +353,11 @@ void DebuggerOutputWindow::showOutput(int channel, const QString &output) ...@@ -349,10 +353,11 @@ void DebuggerOutputWindow::showOutput(int channel, const QString &output)
if (line != QLatin1String("(gdb) ")) if (line != QLatin1String("(gdb) "))
m_combinedText->appendPlainText(charForChannel(channel) + line); m_combinedText->appendPlainText(charForChannel(channel) + line);
} }
QTextCursor cursor = m_combinedText->textCursor();
cursor.movePosition(QTextCursor::End); cursor.movePosition(QTextCursor::End);
m_combinedText->setTextCursor(cursor); if (atEnd) {
m_combinedText->ensureCursorVisible(); m_combinedText->setTextCursor(cursor);
m_combinedText->ensureCursorVisible();
}
} }
void DebuggerOutputWindow::showInput(int channel, const QString &input) void DebuggerOutputWindow::showInput(int channel, const QString &input)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment