Commit 7422b479 authored by Eike Ziller's avatar Eike Ziller
Browse files

TextEditors: Remove "optimization"



I couldn't find a situation where this code actually resulted in
performance improvement.

Change-Id: I7d905af36ef11dcba43030dc83670c3d1558f650
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 242ae4ce
......@@ -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;
......
......@@ -490,8 +490,6 @@ protected:
*/
virtual bool openLink(const Link &link, bool inNextSplit = false);
void maybeClearSomeExtraSelections(const QTextCursor &cursor);
/*!
Reimplement this function to change the default replacement text.
*/
......
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