Commit a1384658 authored by Bojan Petrovic's avatar Bojan Petrovic Committed by Leandro Melo

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

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

Change-Id: Ifb163adb2609e17cdbc3df1e90b7e583c75fac49
Reviewed-by: default avatarLeandro Melo <leandro.melo@nokia.com>
parent d96c1a74
......@@ -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;
......
......@@ -179,6 +179,7 @@ public:
virtual void paste(); // reimplemented from BaseTextEditorWidget
virtual void cut(); // reimplemented from BaseTextEditorWidget
virtual void selectAll(); // reimplemented from BaseTextEditorWidget
CPlusPlus::CppModelManagerInterface *modelManager() const;
......
......@@ -5763,6 +5763,12 @@ void BaseTextEditorWidget::cut()
QPlainTextEdit::cut();
}
void BaseTextEditorWidget::selectAll()
{
d->clearBlockSelection();
QPlainTextEdit::selectAll();
}
void BaseTextEditorWidget::copy()
{
if (!textCursor().hasSelection())
......
......@@ -257,6 +257,7 @@ public slots:
virtual void copy();
virtual void paste();
virtual void cut();
virtual void selectAll();
void circularPaste();
......
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