Commit 9e6f387b authored by Leandro Melo's avatar Leandro Melo Committed by Leandro T. C. Melo

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/44Reviewed-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
parent a923cee3
......@@ -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()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment