From 3023495c71e98c6964e569b98f009235b8770c35 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 17 Dec 2009 12:23:01 +0100 Subject: [PATCH] debugger: don't keep scrolling to the end if the user manually moved the cursor --- src/plugins/debugger/debuggeroutputwindow.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/debugger/debuggeroutputwindow.cpp b/src/plugins/debugger/debuggeroutputwindow.cpp index c75fbd5a328..cbca456c8e7 100644 --- a/src/plugins/debugger/debuggeroutputwindow.cpp +++ b/src/plugins/debugger/debuggeroutputwindow.cpp @@ -341,6 +341,10 @@ void DebuggerOutputWindow::showOutput(int channel, const QString &output) { if (output.isEmpty()) 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')) { // FIXME: QTextEdit asserts on really long lines... const int n = 30000; @@ -349,10 +353,11 @@ void DebuggerOutputWindow::showOutput(int channel, const QString &output) if (line != QLatin1String("(gdb) ")) m_combinedText->appendPlainText(charForChannel(channel) + line); } - QTextCursor cursor = m_combinedText->textCursor(); cursor.movePosition(QTextCursor::End); - m_combinedText->setTextCursor(cursor); - m_combinedText->ensureCursorVisible(); + if (atEnd) { + m_combinedText->setTextCursor(cursor); + m_combinedText->ensureCursorVisible(); + } } void DebuggerOutputWindow::showInput(int channel, const QString &input)