forked from qt-creator/qt-creator
Completion: Complete automatically only when in sync
Whith the out-of-GUI completion one can have undesired effects when invoking the completion, continue typing, getting automatic content added to the editor asynchronously, and then noticing that the lastly input characters were "shifted" to a different position. Now we only do partial completions or implicit completions (when there's a single match) if the proposal widget is still in synch with the editor. In other words, if the editor has not received input from the moment the completion was triggered until it was actually displayed. Change-Id: I31683bd596c9f75b9a48bb79dafb48eec8f12a3e Reviewed-on: http://codereview.qt.nokia.com/44 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
committed by
Leandro T. C. Melo
parent
a923cee383
commit
9e6f387bce
@@ -333,7 +333,7 @@ void GenericProposalWidget::setIsSynchronized(bool isSync)
|
||||
void GenericProposalWidget::showProposal(const QString &prefix)
|
||||
{
|
||||
ensurePolished();
|
||||
if (m_d->m_isSynchronized && !prefix.isEmpty())
|
||||
if (!prefix.isEmpty())
|
||||
m_d->m_gotContent = true;
|
||||
m_d->m_model->removeDuplicates();
|
||||
if (!updateAndCheck(prefix))
|
||||
@@ -407,7 +407,8 @@ bool GenericProposalWidget::updateAndCheck(const QString &prefix)
|
||||
|
||||
if (TextEditorSettings::instance()->completionSettings().m_partiallyComplete
|
||||
&& m_d->m_reason == ExplicitlyInvoked
|
||||
&& m_d->m_gotContent) {
|
||||
&& m_d->m_gotContent
|
||||
&& m_d->m_isSynchronized) {
|
||||
if (m_d->m_model->size() == 1) {
|
||||
IAssistProposalItem *item = m_d->m_model->proposalItem(0);
|
||||
if (item->implicitlyApplies()) {
|
||||
|
||||
Reference in New Issue
Block a user