Changeset 38813 in vbox
- Timestamp:
- Sep 21, 2011 12:28:27 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 74108
- Location:
- trunk/src/VBox/Debugger
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/VBoxDbgConsole.cpp
r35346 r38813 94 94 95 95 void 96 VBoxDbgConsoleOutput::appendText(const QString &rStr )96 VBoxDbgConsoleOutput::appendText(const QString &rStr, bool fClearSelection) 97 97 { 98 98 Assert(m_hGUIThread == RTThreadNativeSelf()); … … 102 102 103 103 /* 104 * Insert all in one go and make sure it's visible. 104 * Insert all in one go and make sure it's visible. 105 * 106 * We need to move the cursor and unselect any selected text before 107 * inserting anything, otherwise, text will disappear. 105 108 */ 106 109 QTextCursor Cursor = textCursor(); 107 if (!Cursor.atEnd()) 108 moveCursor(QTextCursor::End); /* make sure we append the text */ 109 Cursor.insertText(rStr); 110 ensureCursorVisible(); 110 if (!fClearSelection && Cursor.hasSelection()) 111 { 112 QTextCursor SavedCursor = Cursor; 113 Cursor.clearSelection(); 114 Cursor.movePosition(QTextCursor::End); 115 116 Cursor.insertText(rStr); 117 118 setTextCursor(SavedCursor); 119 } 120 else 121 { 122 if (Cursor.hasSelection()) 123 Cursor.clearSelection(); 124 if (!Cursor.atEnd()) 125 Cursor.movePosition(QTextCursor::End); 126 127 Cursor.insertText(rStr); 128 129 setTextCursor(Cursor); 130 ensureCursorVisible(); 131 } 111 132 } 112 133 … … 381 402 m_pszInputBuf[m_cbInputBuf++] = '\n'; 382 403 383 m_pOutput->appendText(rCommand + "\n" );404 m_pOutput->appendText(rCommand + "\n", true /*fClearSelection*/); 384 405 m_pOutput->ensureCursorVisible(); 385 406 … … 401 422 if (m_cbOutputBuf) 402 423 { 403 m_pOutput->appendText(QString::fromUtf8((const char *)m_pszOutputBuf, (int)m_cbOutputBuf) );424 m_pOutput->appendText(QString::fromUtf8((const char *)m_pszOutputBuf, (int)m_cbOutputBuf), false /*fClearSelection*/); 404 425 m_cbOutputBuf = 0; 405 426 } -
trunk/src/VBox/Debugger/VBoxDbgConsole.h
r31530 r38813 54 54 * unless the previous char was a newline ('\n'). 55 55 * 56 * @param rStr The text string to append. 57 */ 58 virtual void appendText(const QString &rStr); 56 * @param rStr The text string to append. 57 * @param fClearSelection Whether to clear selected text before appending. 58 * If @c false the selection and window position 59 * are preserved. 60 */ 61 virtual void appendText(const QString &rStr, bool fClearSelection); 59 62 60 63 protected:
Note:
See TracChangeset
for help on using the changeset viewer.