From b0cc9fa4e731d5e5dd17c472151f6cc76b9fa897 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen <erik.verbruggen@nokia.com> Date: Wed, 19 May 2010 14:09:43 +0200 Subject: [PATCH] Tuned the automatic preprocessor competion. To only run if the pound/hash sign is at the start of the line. --- src/plugins/cpptools/cppcodecompletion.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index e45d9261c69..a68a4cd127c 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -636,6 +636,16 @@ bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor) { const int pos = editor->position(); if (startOfOperator(editor, pos, /*token =*/ 0, /*want function call=*/ true) != pos) { + if (m_completionOperator == T_POUND) { + if (TextEditor::BaseTextEditor *edit = qobject_cast<TextEditor::BaseTextEditor *>(editor->widget())) { + QTextCursor tc(edit->document()); + tc.setPosition(pos); + return tc.columnNumber() == 1; + } + + return false; + } + return true; } -- GitLab