forked from qt-creator/qt-creator
TextEditor: set the cursor to the widget before closing the edit block
This will make sure that code reacting on the document change signal can
get the final cursor position from the widget. More specificly this
fixes requesting copilot suggestions when automatic text is inserted
like closing parentheses when typing "if ("
Change-Id: I01a13e67e72b89010fe39de3d0def0622a9b08b8
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -2894,13 +2894,13 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e)
|
||||
if (!autoText.isEmpty())
|
||||
cursor.setPosition(autoText.length() == 1 ? cursor.position() : cursor.anchor());
|
||||
|
||||
setTextCursor(cursor);
|
||||
|
||||
if (doEditBlock) {
|
||||
cursor.endEditBlock();
|
||||
if (cursorWithinSnippet)
|
||||
d->m_snippetOverlay->updateEquivalentSelections(textCursor());
|
||||
}
|
||||
|
||||
setTextCursor(cursor);
|
||||
}
|
||||
|
||||
if (!ro && e->key() == Qt::Key_Delete && d->m_parenthesesMatchingEnabled)
|
||||
|
||||
Reference in New Issue
Block a user