| 291 | } |
| 292 | |
| 293 | void GDBOutputWidget::flushPending() |
| 294 | { |
| 295 | m_gdbView->setUpdatesEnabled(false); |
| 296 | |
| 297 | // QTextEdit adds newline after paragraph automatically. |
| 298 | // So, remove trailing newline to avoid double newlines. |
| 299 | if (m_pendingOutput.endsWith(QLatin1Char('\n'))) |
| 300 | m_pendingOutput.chop(1); |
| 301 | Q_ASSERT(!m_pendingOutput.endsWith(QLatin1Char('\n'))); |
| 302 | |
| 303 | QTextDocument *document = m_gdbView->document(); |
| 304 | QTextCursor cursor(document); |
| 305 | cursor.movePosition(QTextCursor::End); |
| 306 | cursor.insertHtml(m_pendingOutput); |
| 307 | m_pendingOutput.clear(); |
| 308 | |
| 309 | m_gdbView->verticalScrollBar()->setValue(m_gdbView->verticalScrollBar()->maximum()); |
| 310 | m_gdbView->setUpdatesEnabled(true); |
| 311 | m_gdbView->update(); |
| 312 | if (m_cmdEditorHadFocus) { |
| 313 | m_userGDBCmdEditor->setFocus(); |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | void GDBOutputWidget::debuggerStateChanged(DBGStateFlags newState) |
| 318 | { |