forked from qt-creator/qt-creator
Editor: multi cursor support
Adding a way to create multiple cursors that can insert/remove text at arbitrary positions in the document. Adding cursors is done by pressing alt + up/down or by clicking into the editor while holding the alt key. Fixes: QTCREATORBUG-16013 Change-Id: I495d27d95a3d277220946616ef30efc241da0120 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -164,6 +164,8 @@ void CodeAssistantPrivate::invoke(AssistKind kind, IAssistProvider *provider)
|
||||
|
||||
bool CodeAssistantPrivate::requestActivationCharProposal()
|
||||
{
|
||||
if (m_editorWidget->multiTextCursor().hasMultipleCursors())
|
||||
return false;
|
||||
if (m_assistKind == Completion && m_settings.m_completionTrigger != ManualCompletion) {
|
||||
if (CompletionAssistProvider *provider = identifyActivationSequence()) {
|
||||
requestProposal(ActivationCharacter, Completion, provider);
|
||||
@@ -197,9 +199,6 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason,
|
||||
if (isWaitingForProposal())
|
||||
cancelCurrentRequest();
|
||||
|
||||
if (m_editorWidget->hasBlockSelection())
|
||||
return; // TODO
|
||||
|
||||
if (!provider) {
|
||||
if (kind == Completion)
|
||||
provider = m_editorWidget->textDocument()->completionAssistProvider();
|
||||
@@ -528,8 +527,11 @@ void CodeAssistantPrivate::startAutomaticProposalTimer()
|
||||
|
||||
void CodeAssistantPrivate::automaticProposalTimeout()
|
||||
{
|
||||
if (isWaitingForProposal() || (isDisplayingProposal() && !m_proposal->isFragile()))
|
||||
if (isWaitingForProposal()
|
||||
|| m_editorWidget->multiTextCursor().hasMultipleCursors()
|
||||
|| (isDisplayingProposal() && !m_proposal->isFragile())) {
|
||||
return;
|
||||
}
|
||||
|
||||
requestProposal(IdleEditor, Completion);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user