[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdevelop/languages/cpp
From: Adam Treat <manyoso () yahoo ! com>
Date: 2005-03-10 0:37:38
Message-ID: 20050310003738.25DB510B25 () office ! kde ! org
[Download RAW message or body]
CVS commit by treat:
* Revert to an opt-in procedure for determining whether to complete for
a textChanged signal with a given char. This preserves Matt's change (it'll
complete for all alphabetic chars still), but gets rid of silly completes for
random non-alphabetic chars. The code is more readable too ;)
M +15 -10 cppcodecompletion.cpp 1.156
--- kdevelop/languages/cpp/cppcodecompletion.cpp #1.155:1.156
@@ -7,4 +7,6 @@
copyright : (C) 2002,2003 by Roberto Raggi
email : roberto@kdevelop.org
+ copyright : (C) 2005 by Adam Treat
+ email : manyoso@yahoo.com
***************************************************************************/
@@ -441,16 +443,19 @@ void CppCodeCompletion::slotTextChanged(
m_ccColumn = 0;
- if ( ( m_pSupport->codeCompletionConfig() ->automaticCodeCompletion() &&
- ( !ch.isEmpty() && ch != "\n" && ch != " " && ch != "\t" &&
- ch != ";" && ch != "{" && ch != "}" ) //TODO optimize, maybe use a qregexp
- /*(ch == "." || ch2 == "->" || ch2 == "::") */ ) ||
+ bool argsHint = m_pSupport->codeCompletionConfig() ->automaticArgumentsHint();
+ bool codeComplete = m_pSupport->codeCompletionConfig() ->automaticCodeCompletion();
+ bool headComplete = m_pSupport->codeCompletionConfig() ->automaticHeaderCompletion();
+
+ QRegExp chRx("([A-Z])|([a-z])|(\\.)"); //completes on alpha chars and '.'
+ QRegExp ch2Rx("(->)|(\\:\\:)"); //completes on "->" and "::"
+
+ if ( ( argsHint && ch == "(" ) ||
( strCurLine.simplifyWhiteSpace().contains("virtual") ) ||
- ( m_pSupport->codeCompletionConfig() ->automaticArgumentsHint() && ch == "(" ) ||
- ( m_pSupport->codeCompletionConfig() ->automaticHeaderCompletion() && ( ch == "\"" || ch == "<" ) &&
- m_includeRx.search( strCurLine ) != -1 ) )
+ ( codeComplete && ( chRx.search( ch ) != -1 || ch2Rx.search( ch2 ) != -1 ) ) ||
+ ( headComplete && ( ch == "\"" || ch == "<" ) && m_includeRx.search( strCurLine ) != -1 ) )
{
+ int time;
m_ccLine = nLine;
m_ccColumn = nCol;
- int time;
if ( ch == "(" )
time = m_pSupport->codeCompletionConfig() ->argumentsHintDelay();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic