From f224c68b322fd526a4656859eaa41f51e7f6f39f Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 12 Nov 2012 13:03:10 +0100 Subject: [PATCH] Editor: Fix animate matching parenthesis in folded code Task-number: QTCREATORBUG-5877 Change-Id: I1012a1f8d8f925ed1a002d457b856df103e9f703 Reviewed-by: Nikolai Kosjar Reviewed-by: David Schulz --- src/plugins/texteditor/basetexteditor.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 55d24710942..d58ab19fee4 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -5090,9 +5090,6 @@ void BaseTextEditorWidget::_q_matchParentheses() extraSelections.append(sel); } else { - if (d->m_displaySettings.m_animateMatchingParentheses) - animatePosition = backwardMatch.selectionStart(); - sel.cursor = backwardMatch; sel.format = d->m_matchFormat; @@ -5100,6 +5097,9 @@ void BaseTextEditorWidget::_q_matchParentheses() sel.cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); extraSelections.append(sel); + if (d->m_displaySettings.m_animateMatchingParentheses && sel.cursor.block().isVisible()) + animatePosition = backwardMatch.selectionStart(); + sel.cursor.setPosition(backwardMatch.selectionEnd()); sel.cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor); extraSelections.append(sel); @@ -5114,9 +5114,6 @@ void BaseTextEditorWidget::_q_matchParentheses() extraSelections.append(sel); } else { - if (d->m_displaySettings.m_animateMatchingParentheses) - animatePosition = forwardMatch.selectionEnd()-1; - sel.cursor = forwardMatch; sel.format = d->m_matchFormat; @@ -5125,6 +5122,9 @@ void BaseTextEditorWidget::_q_matchParentheses() extraSelections.append(sel); sel.cursor.setPosition(forwardMatch.selectionEnd()); + if (d->m_displaySettings.m_animateMatchingParentheses && sel.cursor.block().isVisible()) + animatePosition = forwardMatch.selectionEnd() - 1; + sel.cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor); extraSelections.append(sel); }