Author Topic: Tooltip is displayed incorrectly  (Read 6234 times)

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Tooltip is displayed incorrectly
« 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>.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Tooltip is displayed incorrectly
« Reply #1 on: October 27, 2011, 06:47:28 pm »
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!]

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Tooltip is displayed incorrectly
« Reply #2 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

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5930
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Tooltip is displayed incorrectly
« Reply #3 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
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.

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Tooltip is displayed incorrectly
« Reply #4 on: October 28, 2011, 09:34:58 am »
The tooltip should show Int<signed char>

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5930
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Tooltip is displayed incorrectly
« Reply #5 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!!!
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.

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Tooltip is displayed incorrectly
« Reply #6 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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5930
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Tooltip is displayed incorrectly
« Reply #7 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.
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.

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Tooltip is displayed incorrectly
« Reply #8 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

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5930
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Tooltip is displayed incorrectly
« Reply #9 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, 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.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Tooltip is displayed incorrectly
« Reply #10 on: October 29, 2011, 02:13:04 pm »