[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kdevelop-devel
Subject:    Re: Bug#39548: code autocompletion freezes kdevelop
From:       Roberto Raggi <raggi () cli ! di ! unipi ! it>
Date:       2002-03-20 13:58:52
[Download RAW message or body]

Hi,
i wrote a simple patch to solve the problem...
now code completion is activated when a user press '(' or '.'...
with this patch a timer starts while a user press '(' or '.' and code 
completion popups only after the timeout..
what do you think? can i apply my patch to CVS?

ciao robe


On Wednesday 20 March 2002 08:43, gigafalk@yahoo.com wrote:
> Hi,
>
> Roberto Raggi wrote:
> > hi tomek, hi all,
> > i think that we must disable "argument's hint" as default..
> > what do you think??
>
> Maybe it's possible to let the program look in
> KControl-->Information-->Processor-->cpuMHz and switch the feature off for
> all machines less than 1GHz.
> I've got no problem with my machine here and would like to keep the
> feature.
>
> Ciao,
> F@lk
>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> _______________________________________________
> Kdevelop-devel mailing list
> Kdevelop-devel@barney.cs.uni-potsdam.de
> http://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel

["kdevelop.patch" (text/x-diff)]

? kdevelop.patch
Index: codecompletion_arghint.cpp
===================================================================
RCS file: /home/kde/kdevelop/kdevelop/Attic/codecompletion_arghint.cpp,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 codecompletion_arghint.cpp
--- codecompletion_arghint.cpp	2002/03/07 21:13:46	1.1.2.5
+++ codecompletion_arghint.cpp	2002/03/20 13:48:56
@@ -120,7 +120,7 @@
 	connect ( m_pPrev, SIGNAL ( clicked() ), this, SLOT ( gotoPrev() ) );
 	connect ( m_pNext, SIGNAL ( clicked() ), this, SLOT ( gotoNext() ) );
 
-	m_nNumFunc = m_nCurFunc = m_nCurLine = 0;
+	m_nNumFunc = m_nCurFunc = m_nCurLine = m_nCurCol = 0;
 
 	m_nCurArg = 1;
 
Index: cppcodecompletion.cpp
===================================================================
RCS file: /home/kde/kdevelop/kdevelop/Attic/cppcodecompletion.cpp,v
retrieving revision 1.1.2.29
diff -u -r1.1.2.29 cppcodecompletion.cpp
--- cppcodecompletion.cpp	2002/03/11 10:14:13	1.1.2.29
+++ cppcodecompletion.cpp	2002/03/20 13:48:56
@@ -30,6 +30,7 @@
 #include <qapplication.h>
 #include <qregexp.h>
 #include <qmap.h>
+#include <qtimer.h>
 
 #include <kdebug.h>
 #include <kregexp.h>
@@ -176,6 +177,9 @@
     connect(m_pArgHint,SIGNAL(argHintHided()),SIGNAL(argHintHided()));
 
     connect(m_edit, SIGNAL ( newCurPos() ), this, SLOT ( slotCursorPosChanged () ) );
+
+    m_pTimer = new QTimer( this );
+    connect( m_pTimer, SIGNAL(timeout()), this, SLOT(completeText()) );
 }
 
 void CppCodeCompletion::showCompletionBox(QValueList<CompletionEntry> complList,int offset){
@@ -211,6 +215,7 @@
         int line = ed->cursorPosition().y();
         int col = ed->cursorPosition().x();
         if( e->type() == QEvent::KeyPress ){
+            m_pTimer->stop();
             // kdDebug() << "Project = " << prj << endl;
             QKeyEvent* ke = (QKeyEvent*) e;
             if( ke->key() == Key_Tab && !m_edit->currentWord().isEmpty() ){
@@ -226,7 +231,8 @@
                 int attr = l->getAttr( col );
                 if( attr == 13 ){
                     kdDebug() << "---------------------------> complete (enabled by robe :-)" << endl;
-                    completeText();
+                    m_pTimer->start( 500, true );
+                    // completeText();
                 }
                 return TRUE;
             } else if( m_pDevelop->getAutomaticArgsHint() &&
@@ -242,7 +248,8 @@
                     while( index>=0 && s[index].isSpace() )
                         --index;
                     if( s[index].isLetterOrNumber() || s[index] == '_' ){
-                        completeText();
+                        m_pTimer->start( 500, true );
+                        // completeText();
                     }
                 }
                 return TRUE;
Index: cppcodecompletion.h
===================================================================
RCS file: /home/kde/kdevelop/kdevelop/Attic/cppcodecompletion.h,v
retrieving revision 1.1.2.8
diff -u -r1.1.2.8 cppcodecompletion.h
--- cppcodecompletion.h	2002/03/01 13:28:41	1.1.2.8
+++ cppcodecompletion.h	2002/03/20 13:48:56
@@ -33,6 +33,7 @@
 class CParsedContainer;
 class CParsedMethod;
 class CParsedAttribute;
+class QTimer;
 
 class CompletionEntry {
 public:
@@ -109,6 +110,7 @@
     int m_lineCursor;
     int m_colCursor;
     int m_offset;
+    QTimer* m_pTimer;
 
 public slots:
     void slotCursorPosChanged();

_______________________________________________
Kdevelop-devel mailing list
Kdevelop-devel@barney.cs.uni-potsdam.de
http://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic