forked from qt-creator/qt-creator
Copilot: Add insert next word action
Fixes: QTCREATORBUG-28959 Change-Id: Ied53ad5676133e2eb71988ecfcce90c5ad77e3c3 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -2577,6 +2577,21 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e)
|
||||
const bool inOverwriteMode = overwriteMode();
|
||||
const bool hasMultipleCursors = cursor.hasMultipleCursors();
|
||||
|
||||
if (TextSuggestion *suggestion = TextDocumentLayout::suggestion(d->m_suggestionBlock)) {
|
||||
if (e->matches(QKeySequence::MoveToNextWord)) {
|
||||
e->accept();
|
||||
if (suggestion->applyWord(this))
|
||||
d->clearCurrentSuggestion();
|
||||
return;
|
||||
} else if (e->modifiers() == Qt::NoModifier
|
||||
&& (e->key() == Qt::Key_Tab || e->key() == Qt::Key_Backtab)) {
|
||||
e->accept();
|
||||
if (suggestion->apply())
|
||||
d->clearCurrentSuggestion();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ro
|
||||
&& (e == QKeySequence::InsertParagraphSeparator
|
||||
|| (!d->m_lineSeparatorsAllowed && e == QKeySequence::InsertLineSeparator))) {
|
||||
@@ -2695,12 +2710,6 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e)
|
||||
return;
|
||||
}
|
||||
QTextCursor cursor = textCursor();
|
||||
if (TextSuggestion *suggestion = TextDocumentLayout::suggestion(d->m_suggestionBlock)) {
|
||||
suggestion->apply();
|
||||
d->clearCurrentSuggestion();
|
||||
e->accept();
|
||||
return;
|
||||
}
|
||||
if (d->m_skipAutoCompletedText && e->key() == Qt::Key_Tab) {
|
||||
bool skippedAutoCompletedText = false;
|
||||
while (!d->m_autoCompleteHighlightPos.isEmpty()
|
||||
|
||||
Reference in New Issue
Block a user