C++: Select All select the symbol while renaming symbol

https://bugreports.qt.nokia.com//browse/QTCREATORBUG-5520

Change-Id: Ifb163adb2609e17cdbc3df1e90b7e583c75fac49
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
Bojan Petrovic
2012-01-18 12:09:41 +01:00
committed by Leandro Melo
parent d96c1a746e
commit a138465848
4 changed files with 29 additions and 0 deletions

View File

@@ -579,6 +579,27 @@ void CPPEditorWidget::cut()
finishRename();
}
void CPPEditorWidget::selectAll()
{
// if we are currently renaming a symbol
// and the cursor is over that symbol, select just that symbol
if (m_currentRenameSelection != NoCurrentRenameSelection) {
QTextCursor cursor = textCursor();
int selectionBegin = m_currentRenameSelectionBegin.position();
int selectionEnd = m_currentRenameSelectionEnd.position();
if (cursor.position() >= selectionBegin
&& cursor.position() <= selectionEnd) {
cursor.setPosition(selectionBegin);
cursor.setPosition(selectionEnd, QTextCursor::KeepAnchor);
setTextCursor(cursor);
return;
}
}
BaseTextEditorWidget::selectAll();
}
CppModelManagerInterface *CPPEditorWidget::modelManager() const
{
return m_modelManager;