Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: Folco on November 29, 2010, 06:50:47 pm

Title: Bad completion of destructor
Post by: Folco on November 29, 2010, 06:50:47 pm
I think I get a real issue this time ^^
Code
class Abc
{
    Abc ();
    ~Abc ();
};

Abc::~|
In the completion box, if I select ~Abc, then the line is "Abc::~~Abc". It would be better to have "Abc::~Abc".
Title: Re: Bad completion of destructor
Post by: Jenna on November 29, 2010, 07:25:13 pm
I think I get a real issue this time ^^
Code
class Abc
{
    Abc ();
    ~Abc ();
};

Abc::~|
In the completion box, if I select ~Abc, then the line is "Abc::~~Abc". It would be better to have "Abc::~Abc".
Confirmed on linux, it only works correctly, if cc kicks in after the second colon and you chose ~Abc.
If I cancel cc and type ~ cc does not kick in and if I force it with Ctrl+Space, it does not show me the correct choice, if I force cc after typing Abc::~A, it shows only the class Abc (and some other tokens, that begin with "a" or "A"), not the constructor or destructor.
Title: Re: Bad completion of destructor
Post by: Folco on November 29, 2010, 10:43:17 pm
Oops, forgotten to say that I get that with Kubuntu 64b, svn debugger branch compiled today.
Title: Re: Bad completion of destructor
Post by: ollydbg on November 30, 2010, 01:54:26 am
I think I get a real issue this time ^^
Code
class Abc
{
    Abc ();
    ~Abc ();
};

Abc::~|
In the completion box, if I select ~Abc, then the line is "Abc::~~Abc". It would be better to have "Abc::~Abc".
Confirmed on linux, it only works correctly, if cc kicks in after the second colon and you chose ~Abc.
If I cancel cc and type ~ cc does not kick in and if I force it with Ctrl+Space, it does not show me the correct choice, if I force cc after typing Abc::~A, it shows only the class Abc (and some other tokens, that begin with "a" or "A"), not the constructor or destructor.
True, the reason is:
Code
Abc::~A|<------------caret  here
backward search from the caret just stop after the "~", so this is the same as:
Code
   A|<------------caret  here
So, as you said:
Quote
it shows only the class Abc (and some other tokens, that begin with "a" or "A")

It seems Folco's problem is not the same as jens.
@Folco:
What is the exact step?
You use use the ctrl+space at the caret below?
Code
Abc::~|<-----------caret here


Title: Re: Bad completion of destructor
Post by: Jenna on November 30, 2010, 07:35:47 am
If I cancel cc and type ~ cc does not kick in and if I force it with Ctrl+Space, it does not show me the correct choice
in this case it shows only tokens from the global namespace, nneither the constructor or destructor nor the class itself.
So it seems the tilde is not recognized correctly (after it is typed).
The token itself is known, because cc kicks in correctly after the second colon and shows Abc and ~Abc.
If cc is not cancelled after typing the colon and you type the tilde (~), the selection in the cc-box jumps correctly to ~Abc, but if you now hit enter it comes to the error described by Folco.

I think it's the same cause for both issues.
Title: Re: Bad completion of destructor
Post by: Folco on November 30, 2010, 01:44:10 pm
Quote
@Folco:
What is the exact step?
You use use the ctrl+space at the caret below?
Code
Abc::~|<-----------caret here
No. The completion box appears automatically after I type the second colon. When I select "~Abc" in this box, I get "Abc::~~Abc".
Title: Re: Bad completion of destructor
Post by: Jenna on November 30, 2010, 01:48:35 pm
Quote
@Folco:
What is the exact step?
You use use the ctrl+space at the caret below?
Code
Abc::~|<-----------caret here
No. The completion box appears automatically after I type the second colon. When I select "~Abc" in this box, I get "Abc::~~Abc".
Dou you get the double tilde, if you select ~Abc before typing the tilde in the source or after typing it ?
Title: Re: Bad completion of destructor
Post by: ollydbg on November 30, 2010, 03:14:55 pm
Quote
@Folco:
What is the exact step?
You use use the ctrl+space at the caret below?
Code
Abc::~|<-----------caret here
No. The completion box appears automatically after I type the second colon. When I select "~Abc" in this box, I get "Abc::~~Abc".
I just follow your steps, and there is no double tilde. (windows, latest debugger branch)
Title: Re: Bad completion of destructor
Post by: Folco on November 30, 2010, 06:40:02 pm
Quote
Dou you get the double tilde, if you select ~Abc before typing the tilde in the source or after typing it ?
I get it after typing it.

In these two cases, the chars in the line are typed by hand, and the completion box appears automatically.
First case : (http://www.mirari.fr/CZtq)
I get a correct behaviour when I hit Enter.


Second case : (http://www.mirari.fr/dPAR)
If I hit Enter, I get a double tilde.


I got these shots under Win XP SP3, latest dbg branch too.