diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 55d2471094213cafa608803cf535bfb423862932..d58ab19fee40e4284bf765653fc59668cf8b77f1 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); }