Commit e395af1a authored by hjk's avatar hjk

Debugger: Force shrinking of internal structures of log pane.

Just keeping a maximum number of lines is not enough.

Task-number: QTCREATORBUG-4620
Change-Id: Iedb947dc55e55fa3717da88c4e5762526423bbb6
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 287ba032
......@@ -189,11 +189,18 @@ public:
void append(const QString &text)
{
const int N = 100000;
if (blockCount() > N) {
QTextBlock block = document()->findBlock(9 * N / 10);
const int bc = blockCount();
if (bc > N) {
QTextDocument *doc = document();
QTextBlock block = doc->findBlockByLineNumber(bc * 9 / 10);
QTextCursor tc(block);
tc.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
tc.movePosition(QTextCursor::Start, QTextCursor::KeepAnchor);
tc.removeSelectedText();
// Seems to be the only way to force shrinking of the
// allocated data.
QString contents = doc->toHtml();
doc->clear();
doc->setHtml(contents);
}
appendPlainText(text);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment