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();
|
||||
|
||||
QTextCursor cursor = textCursor();
|
||||
maybeClearSomeExtraSelections(cursor);
|
||||
cursor.beginEditBlock();
|
||||
|
||||
if (cursor.hasSelection()) {
|
||||
@@ -4678,13 +4677,11 @@ void BaseTextEditorWidget::indentInsertedText(const QTextCursor &tc)
|
||||
|
||||
void BaseTextEditorWidget::indent(QTextDocument *doc, const QTextCursor &cursor, QChar typedChar)
|
||||
{
|
||||
maybeClearSomeExtraSelections(cursor);
|
||||
d->m_document->indenter()->indent(doc, cursor, typedChar, tabSettings());
|
||||
}
|
||||
|
||||
void BaseTextEditorWidget::reindent(QTextDocument *doc, const QTextCursor &cursor)
|
||||
{
|
||||
maybeClearSomeExtraSelections(cursor);
|
||||
d->m_document->indenter()->reindent(doc, cursor, tabSettings());
|
||||
}
|
||||
|
||||
@@ -5223,25 +5220,6 @@ QList<QTextEdit::ExtraSelection> BaseTextEditorWidget::extraSelections(ExtraSele
|
||||
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
|
||||
{
|
||||
QList<QTextEdit::ExtraSelection> all;
|
||||
|
||||
Reference in New Issue
Block a user