From 7aeec31b77234e6bb5a0483ca809d7a8216f4c05 Mon Sep 17 00:00:00 2001 From: rekols Date: Tue, 4 Dec 2018 15:44:01 +0800 Subject: [PATCH] fix: highlight brackets will modify the document status. Change-Id: Ie996630aaf95c643fcf33cee94b3d37985da8b91 --- src/dtextedit.cpp | 15 ++------------- src/dtextedit.h | 1 - 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/dtextedit.cpp b/src/dtextedit.cpp index 10d81b40..c42dc12f 100644 --- a/src/dtextedit.cpp +++ b/src/dtextedit.cpp @@ -1908,18 +1908,10 @@ void DTextEdit::updateHighlightBrackets(const QChar &openChar, const QChar &clos QTextCursor cursor = textCursor(); int position = cursor.position(); + QTextCursor bracketBeginCursor; + QTextCursor bracketEndCursor; cursor.clearSelection(); - if (!m_brackets.contains(openChar)) { - m_brackets[openChar] = QTextCursor(); - } - if (!m_brackets.contains(closeChar)) { - m_brackets[closeChar] = QTextCursor(); - } - - QTextCursor bracketBeginCursor = m_brackets[openChar]; - QTextCursor bracketEndCursor = m_brackets[closeChar]; - if (!bracketBeginCursor.isNull() || !bracketEndCursor.isNull()) { bracketBeginCursor.setCharFormat(QTextCharFormat()); bracketEndCursor.setCharFormat(QTextCharFormat()); @@ -1993,9 +1985,6 @@ void DTextEdit::updateHighlightBrackets(const QChar &openChar, const QChar &clos m_bracketsSelections.clear(); m_bracketsSelections << startExtra << endExtra; } - - m_brackets[openChar] = bracketBeginCursor; - m_brackets[closeChar] = bracketEndCursor; } void DTextEdit::setThemeWithPath(const QString &path) diff --git a/src/dtextedit.h b/src/dtextedit.h index b2f4173a..1b861481 100644 --- a/src/dtextedit.h +++ b/src/dtextedit.h @@ -294,7 +294,6 @@ public slots: bool m_highlighted = false; - QMap m_brackets; QTextCharFormat m_bracketMatchFormat; };