diff --git a/src/plugins/texteditor/snippets/snippetoverlay.cpp b/src/plugins/texteditor/snippets/snippetoverlay.cpp index 6824c0470ac..f7b3cf80c91 100644 --- a/src/plugins/texteditor/snippets/snippetoverlay.cpp +++ b/src/plugins/texteditor/snippets/snippetoverlay.cpp @@ -38,8 +38,13 @@ void SnippetOverlay::setFinalSelection(const QTextCursor &cursor, const QColor & void SnippetOverlay::updateEquivalentSelections(const QTextCursor &cursor) { const int ¤tIndex = indexForCursor(cursor); + if (currentIndex == m_finalSelectionIndex) { + accept(); + return; + } if (currentIndex < 0) return; + QTC_ASSERT(currentIndex < m_selections.size(), return); const QString ¤tText = cursorForIndex(currentIndex).selectedText(); const QList &equivalents = m_variables.value(m_selections[currentIndex].variableIndex); for (int i : equivalents) {