Add Highlight Matching Parentheses setting

Task-number: QTCREATORBUG-8008

Change-Id: If1989eb850e82636c735a319bc7c4950a01dd33c
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
Vasiliy Sorokin
2012-10-11 14:46:18 +04:00
committed by David Schulz
parent f1cd57e2b2
commit 6a90a1a740
5 changed files with 82 additions and 57 deletions

View File

@@ -4071,7 +4071,14 @@ void BaseTextEditorWidget::updateHighlights()
&& d->m_animator == 0) {
d->m_parenthesesMatchingTimer->start(50);
} else {
// use 0-timer, not direct call, to give the syntax highlighter a chance
// when we uncheck "highlight matching parentheses"
// we need clear current selection before viewport update
// otherwise we get sticky highlighted parentheses
if (!d->m_displaySettings.m_highlightMatchingParentheses) {
setExtraSelections(ParenthesesMatchingSelection, QList<QTextEdit::ExtraSelection>());
}
// use 0-timer, not direct call, to give the syntax highlighter a chance
// to update the parentheses information
d->m_parenthesesMatchingTimer->start(0);
}
@@ -5060,7 +5067,9 @@ void BaseTextEditorAnimator::finish()
void BaseTextEditorWidget::_q_matchParentheses()
{
if (isReadOnly())
if (isReadOnly()
|| !(d->m_displaySettings.m_highlightMatchingParentheses
|| d->m_displaySettings.m_animateMatchingParentheses))
return;
QTextCursor backwardMatch = textCursor();
@@ -5149,8 +5158,8 @@ void BaseTextEditorWidget::_q_matchParentheses()
connect(d->m_animator, SIGNAL(updateRequest(int,QPointF,QRectF)),
this, SLOT(_q_animateUpdate(int,QPointF,QRectF)));
}
setExtraSelections(ParenthesesMatchingSelection, extraSelections);
if (d->m_displaySettings.m_highlightMatchingParentheses)
setExtraSelections(ParenthesesMatchingSelection, extraSelections);
}
void BaseTextEditorWidget::_q_highlightBlocks()