News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Tooltip is displayed incorrectly

Started by smallB, October 27, 2011, 06:06:18 PM

Previous topic - Next topic

smallB

When hovering over a variable of type Int<signed char> the tooltip being displayed says Int<signedchar>.

oBFusCATed

Minimal code sample?
OS/C::B/compiler version?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

smallB

template<class Int_T, Int_T Min_Range,
         Int_T Max_Range>
class Int
{};

OS: W8
c::b: svn 7452
compiler: gcc 4.6.1

ollydbg

Quote from: smallB on October 28, 2011, 08:28:28 AM
template<class Int_T, Int_T Min_Range,
         Int_T Max_Range>
class Int
{};

OS: W8
c::b: svn 7452
compiler: gcc 4.6.1
So, when you hover on which variable? What is the expect tip should show?

PS: template handling in CC's parser is not quite good. :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

smallB

The tooltip should show Int<signed char>

ollydbg

I just test the code:
template<class Int_T, Int_T Min_Range,
         Int_T Max_Range>
class Int
{};

Int < signed char > aaaa;


Then hover on the "aaaa", it looks like it will show "Int<signedchar>", so it is a bug!!

I will take some time to check it. Thanks for the report!!!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

smallB

Thanks! It's great feeling that I can contribute in my tiny way to make this great IDE even better.

ollydbg

The patch should fix your problem.
Index: E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/parserthread.cpp
===================================================================
--- E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/parserthread.cpp (revision 7535)
+++ E:/code/cb/cb_trunk/src/plugins/codecompletion/parser/parserthread.cpp (working copy)
@@ -2646,6 +2646,7 @@
         else if (tmp==ParserConsts::gt)
         {
             --nestLvl;
+            m_TemplateArgument.Trim();
             m_TemplateArgument << tmp;
         }
         else if (tmp==ParserConsts::semicolon)
@@ -2658,7 +2659,7 @@
         else if (tmp.IsEmpty())
             break;
         else
-            m_TemplateArgument << tmp;
+            m_TemplateArgument << tmp <<_T(" ");
         if (nestLvl <= 0)
             break;
     }


BTW:
If you write the code: (No need to write some "template" declaration)

AAA< CCC DDD> EEE;

Then, "EEEE" will be recognized as a variable, and "AAA< CCC DDD>" will be its type string.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

smallB

@ollydbg Hi,  thanks for this patch. This will be probably sounds strange to you but I have absolutely no idea what to do with this patch you've provided. Would you mind telling me next steps?
Thanks

ollydbg

Quote from: smallB on October 29, 2011, 01:09:25 PM
Would you mind telling me next steps?
Check out the codeblocks' source code, then you can apply my patch on the source, and later build the codeblocks yourself under Windows.

There are some wiki, see:
Installing Code::Blocks from source on Windows - CodeBlocks, follow the steps and it was easy. :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Alpha