Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: smallB on October 27, 2011, 06:06:18 pm

Title: Tooltip is displayed incorrectly
Post by: smallB on October 27, 2011, 06:06:18 pm
When hovering over a variable of type Int<signed char> the tooltip being displayed says Int<signedchar>.
Title: Re: Tooltip is displayed incorrectly
Post by: oBFusCATed on October 27, 2011, 06:47:28 pm
Minimal code sample?
OS/C::B/compiler version?
Title: Re: Tooltip is displayed incorrectly
Post by: smallB on October 28, 2011, 08:28:28 am
Code
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
Title: Re: Tooltip is displayed incorrectly
Post by: ollydbg on October 28, 2011, 08:40:29 am
Code
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
Title: Re: Tooltip is displayed incorrectly
Post by: smallB on October 28, 2011, 09:34:58 am
The tooltip should show Int<signed char>
Title: Re: Tooltip is displayed incorrectly
Post by: ollydbg on October 29, 2011, 10:58:32 am
I just test the code:
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!!!
Title: Re: Tooltip is displayed incorrectly
Post by: smallB on October 29, 2011, 11:54:23 am
Thanks! It's great feeling that I can contribute in my tiny way to make this great IDE even better.
Title: Re: Tooltip is displayed incorrectly
Post by: ollydbg on October 29, 2011, 12:41:26 pm
The patch should fix your problem.
Code
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)
Code
AAA< CCC DDD> EEE;
Then, "EEEE" will be recognized as a variable, and "AAA< CCC DDD>" will be its type string.
Title: Re: Tooltip is displayed incorrectly
Post by: smallB on October 29, 2011, 01:09:25 pm
@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
Title: Re: Tooltip is displayed incorrectly
Post by: ollydbg on October 29, 2011, 02:09:45 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 (http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows), follow the steps and it was easy. :D
Title: Re: Tooltip is displayed incorrectly
Post by: Alpha on October 29, 2011, 02:13:04 pm
(Also: patch application (http://wiki.codeblocks.org/index.php?title=Creating_a_patch_to_submit_to_BerliOS_(Patch_Tracker)#Patch_application_and_testing).)