forked from qt-creator/qt-creator
TextEditors: Remove "optimization"
I couldn't find a situation where this code actually resulted in performance improvement. Change-Id: I7d905af36ef11dcba43030dc83670c3d1558f650 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -4467,7 +4467,6 @@ void BaseTextEditorWidget::indentOrUnindent(bool doIndent)
|
|||||||
const TextEditor::TabSettings &tabSettings = d->m_document->tabSettings();
|
const TextEditor::TabSettings &tabSettings = d->m_document->tabSettings();
|
||||||
|
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
maybeClearSomeExtraSelections(cursor);
|
|
||||||
cursor.beginEditBlock();
|
cursor.beginEditBlock();
|
||||||
|
|
||||||
if (cursor.hasSelection()) {
|
if (cursor.hasSelection()) {
|
||||||
@@ -4678,13 +4677,11 @@ void BaseTextEditorWidget::indentInsertedText(const QTextCursor &tc)
|
|||||||
|
|
||||||
void BaseTextEditorWidget::indent(QTextDocument *doc, const QTextCursor &cursor, QChar typedChar)
|
void BaseTextEditorWidget::indent(QTextDocument *doc, const QTextCursor &cursor, QChar typedChar)
|
||||||
{
|
{
|
||||||
maybeClearSomeExtraSelections(cursor);
|
|
||||||
d->m_document->indenter()->indent(doc, cursor, typedChar, tabSettings());
|
d->m_document->indenter()->indent(doc, cursor, typedChar, tabSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditorWidget::reindent(QTextDocument *doc, const QTextCursor &cursor)
|
void BaseTextEditorWidget::reindent(QTextDocument *doc, const QTextCursor &cursor)
|
||||||
{
|
{
|
||||||
maybeClearSomeExtraSelections(cursor);
|
|
||||||
d->m_document->indenter()->reindent(doc, cursor, tabSettings());
|
d->m_document->indenter()->reindent(doc, cursor, tabSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5223,25 +5220,6 @@ QList<QTextEdit::ExtraSelection> BaseTextEditorWidget::extraSelections(ExtraSele
|
|||||||
return d->m_extraSelections[kind];
|
return d->m_extraSelections[kind];
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditorWidget::maybeClearSomeExtraSelections(const QTextCursor &cursor)
|
|
||||||
{
|
|
||||||
const int smallSelectionSize = 50 * 50;
|
|
||||||
if (cursor.selectionEnd() - cursor.selectionStart() < smallSelectionSize)
|
|
||||||
return;
|
|
||||||
|
|
||||||
d->m_extraSelections[UndefinedSymbolSelection].clear();
|
|
||||||
d->m_extraSelections[ObjCSelection].clear();
|
|
||||||
d->m_extraSelections[CodeWarningsSelection].clear();
|
|
||||||
|
|
||||||
QList<QTextEdit::ExtraSelection> all;
|
|
||||||
for (int i = 0; i < NExtraSelectionKinds; ++i) {
|
|
||||||
if (i == CodeSemanticsSelection || i == SnippetPlaceholderSelection)
|
|
||||||
continue;
|
|
||||||
all += d->m_extraSelections[i];
|
|
||||||
}
|
|
||||||
QPlainTextEdit::setExtraSelections(all);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BaseTextEditorWidget::extraSelectionTooltip(int pos) const
|
QString BaseTextEditorWidget::extraSelectionTooltip(int pos) const
|
||||||
{
|
{
|
||||||
QList<QTextEdit::ExtraSelection> all;
|
QList<QTextEdit::ExtraSelection> all;
|
||||||
|
|||||||
@@ -490,8 +490,6 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual bool openLink(const Link &link, bool inNextSplit = false);
|
virtual bool openLink(const Link &link, bool inNextSplit = false);
|
||||||
|
|
||||||
void maybeClearSomeExtraSelections(const QTextCursor &cursor);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Reimplement this function to change the default replacement text.
|
Reimplement this function to change the default replacement text.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user