diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 7e8c1c2345ddc95a699af2741277b763f70cd7f2..ba1dd248bdba18847f7d1dc70eec13e48c965659 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -7431,7 +7431,10 @@ void TextEditorWidget::keepAutoCompletionHighlight(bool keepHighlight) void TextEditorWidget::setAutoCompleteSkipPosition(const QTextCursor &cursor) { QTextCursor tc = cursor; - tc.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); + // Create a selection of the next character but keep the current position, otherwise + // the cursor would be removed from the list of automatically inserted text positions + tc.movePosition(QTextCursor::NextCharacter); + tc.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor); d->autocompleterHighlight(tc); }