Skip to content

Commit

Permalink
fix: highlight brackets will modify the document status.
Browse files Browse the repository at this point in the history
Change-Id: Ie996630aaf95c643fcf33cee94b3d37985da8b91
  • Loading branch information
rekols committed Dec 4, 2018
1 parent 78d6528 commit 7aeec31
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
15 changes: 2 additions & 13 deletions src/dtextedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/dtextedit.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ public slots:

bool m_highlighted = false;

QMap<QChar, QTextCursor> m_brackets;
QTextCharFormat m_bracketMatchFormat;
};

Expand Down

0 comments on commit 7aeec31

Please sign in to comment.