From dace83badc2b36c17be6581fb2d729216098743f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= <thorbjorn.lindeijer@nokia.com> Date: Tue, 3 Aug 2010 14:29:28 +0200 Subject: [PATCH] Avoid retriggering the completion box when it's already there There should be no need for the text editor to request an update of the completion box, since when it's there it will have focus and update itself. Reviewed-by: Roberto Raggi --- src/plugins/texteditor/basetexteditor.cpp | 3 +++ src/plugins/texteditor/completionsupport.cpp | 5 +++++ src/plugins/texteditor/completionsupport.h | 3 +++ 3 files changed, 11 insertions(+) diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 323e03b02a3..a842ce94638 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -1415,6 +1415,9 @@ void BaseTextEditor::_q_requestAutoCompletion() { d->m_requestAutoCompletionTimer->stop(); + if (CompletionSupport::instance()->isActive()) + return; + if (d->m_requestAutoCompletionRevision == document()->revision() && d->m_requestAutoCompletionPosition == position()) emit requestAutoCompletion(editableInterface(), false); diff --git a/src/plugins/texteditor/completionsupport.cpp b/src/plugins/texteditor/completionsupport.cpp index 1ae51b106b5..44dfad52199 100644 --- a/src/plugins/texteditor/completionsupport.cpp +++ b/src/plugins/texteditor/completionsupport.cpp @@ -93,6 +93,11 @@ void CompletionSupport::cleanupCompletions() } } +bool CompletionSupport::isActive() const +{ + return m_completionList != 0; +} + void CompletionSupport::autoComplete(ITextEditable *editor, bool forced) { autoComplete_helper(editor, forced, /*quickFix = */ false); diff --git a/src/plugins/texteditor/completionsupport.h b/src/plugins/texteditor/completionsupport.h index 7403ed49005..6cf43cd6a91 100644 --- a/src/plugins/texteditor/completionsupport.h +++ b/src/plugins/texteditor/completionsupport.h @@ -55,6 +55,9 @@ public: CompletionSupport(); static CompletionSupport *instance(); + + bool isActive() const; + public slots: void autoComplete(TextEditor::ITextEditable *editor, bool forced); void quickFix(TextEditor::ITextEditable *editor); -- GitLab