codecompletion's problem

W. Tasin tasin at fhm.edu
Wed Feb 20 18:33:04 UTC 2002


Hi Roberto,

if I understand it correctly you are using the color to decide wheter it 
should be activated or not...
this isn't IMHO a good idea because you can change the color on 
highlighted sources.

Ciao

Walter

Roberto Raggi wrote:

>hi all,
>if you press . or -> in a comment region or within a string, the code 
>completion is activated!! i wrote a simple patch
>that solves the problem, but i don't know if it's a clean solution..
>in fact i use the TextLine attributes from highlight engine..
>
>what do you think?? shall i apply my patch?
>
>ciao robe
>
>
>
>
>------------------------------------------------------------------------
>
>? .cvsignore
>? .directory
>? cprjaddoptsdlg.cpp
>? cprjaddoptsdlg.h
>? rx.patch
>? simple.patch
>Index: cppcodecompletion.cpp
>===================================================================
>RCS file: /home/kde/kdevelop/kdevelop/Attic/cppcodecompletion.cpp,v
>retrieving revision 1.1.2.9
>diff -u -r1.1.2.9 cppcodecompletion.cpp
>--- cppcodecompletion.cpp	2002/02/18 19:00:15	1.1.2.9
>+++ cppcodecompletion.cpp	2002/02/20 13:47:12
>@@ -156,7 +156,11 @@
>                          col > 0 && m_edit->textLine( line )[ col-1 ] == '-') ) {
>                 kdDebug() << "---------------------------> complete (enabled by robe :-)" << endl;
>                 m_edit->insertText( ke->text() );
>-                completeText();
>+                TextLine* l = m_edit->doc()->textLine( line );
>+                int attr = l->getAttr( col );
>+                if( attr == 13 ){
>+                    completeText();
>+                }
>                 return TRUE;
>             }
>         }
>Index: kdevregexp.cpp
>===================================================================
>RCS file: /home/kde/kdevelop/kdevelop/Attic/kdevregexp.cpp,v
>retrieving revision 1.1.2.1
>diff -u -r1.1.2.1 kdevregexp.cpp
>--- kdevregexp.cpp	2002/02/18 19:00:15	1.1.2.1
>+++ kdevregexp.cpp	2002/02/20 13:47:12
>@@ -31,7 +31,7 @@
>       {}
> 
>   ~KDevRegExpData()
>-    { if( rx ) delete( rx ); }
>+    { delete( rx ); rx=0;}
> };
> 
> KDevRegExp::KDevRegExp()
>@@ -68,13 +68,12 @@
> KDevRegExp::~KDevRegExp()
> {
>   delete( d );
>+  d=0;
> }
> 
> void KDevRegExp::init()
> {
>-  if( d->rx ){
>-    delete( d->rx );
>-  }
>+  delete( d->rx );
>   d->rx = new KRegExp( pattern(), caseSensitive() ? "" : "i" );
> }
> 
>@@ -126,7 +125,7 @@
> {
>   const char* s = d->rx->group( grp );
>   if( s ){
>-    return QString::fromLatin1( s, ::strlen(s) );
>+    return QString::fromLatin1( s );
>   }
>   return QString::null;
> }
>

-- 
oohhh sveglia.... il mondo e' ammalato, ma x colpa di chi.........
(Zucchero)
:-------W._Tasin,_FB_04,_FHM-------------------PGP-KeyID:0x7961A645---:
<Key-Fingerprint: 1610 835F 0080 32F4 6140  6CF7 A7D0 44CD 7961A645>
<http://wwwkeys.pgp.net:11371/pks/lookup?op=index&search=0x7961A645&fingerprint=on>







More information about the KDevelop-devel mailing list