Code::Blocks Forums

User forums => Help => Topic started by: oldieNewbie on April 14, 2020, 06:19:32 pm

Title: Display Value Under Cursor - window too small for int variables with short names
Post by: oldieNewbie on April 14, 2020, 06:19:32 pm
I am experiencing a problem with Display Value Under Cursor in the debugger.
Best explained with a screen capture, I think. It shows the whole program at one point in time.

In Frame 1, the variable under the cursor is x which is declared as "int x {1};"
The value window appears to be mostly a working horizontal scroll bar.

In Frame 2, The value of a variable m declared as a double is correctly displayed.

In Frame 3, when I increased the length of the int variable's name to 4 characters ("x123")  the value is readable and the scroll bar disappears.

In Frame 4, in the case of a loop control variable "i" a description of the variable "int main ::i" appears for a few milliseconds and then changes to what is shown.

Further experiment showed that if I assigned a value of 1234567890 to x, the value window would display "x 12345678 int"
It seems that the value window is not displaying short names with small values at all, and truncating larger values when the variable name is short.

I appreciate that adding variables to the watch window is the work-round for this.

Using version 20.03-r11983   Build: Mar 14 2020, 18:11:34 - wx3.1.3 - gcc 8.1.0 (Windows, unicode) - 64 bit
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oBFusCATed on April 14, 2020, 06:23:04 pm
OS and CodeBlocks versions please? What is the DPI of you monitor? Do you change global font sizes?
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oldieNewbie on April 14, 2020, 06:36:58 pm
Using version 20.03-r11983   Build: Mar 14 2020, 18:11:34 - wx3.1.3 - gcc 8.1.0 (Windows, unicode) - 64 bit
Windows 10 Home version 1909 OS build 18363.720
Display resolution 1920 x 1080
I have not changed global font size but did change the value tooltip font to Calibri Regular 10 in the Debugger Common Settings
I have just looked for a default font setting but cannot find one.
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oBFusCATed on April 14, 2020, 06:53:37 pm
Close CodeBlocks.
In AppData there should be a CodeBlocks folder and there a default.conf file.
Open it and find something like
Code
			<TOOLTIP_FONT>
<str>
<![CDATA[Comic Sans MS 8]]>
</str>
</TOOLTIP_FONT>

Delete this, start Code::Blocks and report if it fixes the problem.
Also remember the setting and post it here.
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oldieNewbie on April 14, 2020, 08:38:47 pm
I have done everything you suggested but it has not fixed the problem, in fact it has made it slightly worse, as the value 1234567890 is now displayed as 1234567, a digit shorter than before.
The text is visibly smaller in the value window that does display text (the reason I changed to Calibri 10).

I located
C:\Users\David\AppData\Roaming\CodeBlocks\default.conf
and made a copy before I deleted
Code
			<TOOLTIP_FONT>
<str>
<![CDATA[1;9.75;-13;0;0;0;400;0;0;0;0;3;2;1;34;Calibri]]>
</str>
</TOOLTIP_FONT>

Should I restore this code, or would uninstall and reinstall CodeBlocks be likely to fix the problem?
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oBFusCATed on April 14, 2020, 09:23:21 pm
... would uninstall and reinstall CodeBlocks be likely to fix the problem?
Nope.

Can you tell me which is the default font you use? Just open the font dialog and press cancel.
Also you've posted an image of the watches window which look seems to fine. Can you post the broken tooltip with the default font?

Could someone else try to reproduce the problem on Windows?
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oldieNewbie on April 14, 2020, 10:08:53 pm
CodeBlocks->General Settings->Editor Settings->Font->Choose = Courier New, Regular, 10
Reset Zoom of all editors to default, if leaving dialog = not checked

Tooltip Values of m and y are as shown in previous Watches.jpg
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oBFusCATed on April 14, 2020, 10:12:13 pm
The font for this thing is set in Settings -> Debugger -> Common.
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oldieNewbie on April 14, 2020, 11:51:12 pm
Segoe UI, Regular, 7

Now that I've seen the name, I remember that's what it was before I chose Calibri 10.

Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oBFusCATed on April 16, 2020, 09:40:04 am
Could someone else try to reproduce the problem on Windows?
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oldieNewbie on April 17, 2020, 01:25:57 am
I have reproduced the problem exactly on a different computer, my HP laptop running Windows 10 Home Version 1809 Build 17763.109

I have tried to reproduce the problem using Code::Blocks 17.12 but the debugger seems to be missing from the SourceForge download of codeblocks-17.12mingw-setup.exe

That was the short Version of what I did.
Here follows the long version.

Laptop - Windows 10 Home Version 1809 Build 17763.109
Fresh installation of Code::Blocks 20.03 from FossHUB.
1) Changed nothing from installed defaults except checking the "Evaluate Expression Under Cursor" box.
2) Default Debugger Font noted as Segoe UI Regular 7.
3) Created a new Console Project, overwrote default "Hello World" program in main.cpp with text copy and pasted from Notepad++
4) Compiled and Ran program successfully.
5) Ran debugger to cursor as before.
Results were exactly the same.

I uninstalled Code::Blocks 20.03 with Revo Uninstaller Pro 4.3.0

I downloaded  Code::Blocks 17.12 from SourceForge and installed it.
Code::Blocks 17.12 rev 11256 gcc 5.1.0 32 bit
1) Changed nothing from installed defaults except checking the "Evaluate Expression Under Cursor" box.
2) Default Debugger Font noted as Tahoma Regular 7.
3) Created a new Console Project, overwrote default "Hello World" program in main.cpp with text copy and pasted from Notepad++
4) Compiled and Ran program successfully.
5) Debugging failed: No debugger Found.
6) Looked for gdb.exe using "Search Everything" - not present.

Noted that downloaded codeblocks-20.03mingw-setup.exe is 148,848 KB and codeblocks-17.12mingw-setup.exe is only 88,221 KB.
Am guessing that the debugger is missing from codeblocks-17.12mingw-setup.exe

If someone can tell me where to download it and where to put gdb.exe I will try running the debugger to see if anything changes. I need to do that in the next couple of days as Microsoft is about to force an update to Windows 10 version 1909 on my laptop.
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oBFusCATed on April 17, 2020, 01:43:45 am
I don't intend to install windows 10 any time soon, so if you can't reproduce the problem on some kind of default version of windows 7 64bit, I'm not of much help. :(
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oldieNewbie on April 17, 2020, 11:51:23 am
Thank you for your interest and help so far, oBFusCATed. I appreciate the time you've taken.
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: BlueHazzard on April 17, 2020, 09:03:46 pm
I can reproduce this on windows... But i have absolute no idea about this part of the code....
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oBFusCATed on April 17, 2020, 09:21:52 pm
The fun happens in watchesdlg.cpp:SetMinSize...
Can you check if the values look reasonable?
I guess something is skipped and the calculated size is smaller than the min possible for some of the columns and so this is the result.
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: Samuel on September 15, 2020, 11:55:44 pm
I had the same problem and managed to solve it as follows:

Settings > Debugger > Value Tolltip Font (Choose)

My source was less than the minimum available. That may be your problem.

I hope I can have helped you.
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: gd_on on May 18, 2021, 11:36:14 am
The bug described in this post is here again (C::B svn 12448, wxWidgets 3.1.5, Windows 10, but also with 12446 killerbot nightly). I obtain in any case something which looks like the Frame1 image in the first post, but just a small gray square
Changing the size and/or the font in Settings > Debugger > Choose button has no effect.
I have just added a Fit(); at line 1224 in watchesdlg.cpp and it works again.
At lines 1222 and 1223, the 2 m_sizer->Fit ... look strange. If I eliminate one of them or both, it continues to work. Are they necessary ? May be for other OS or wxWidgets version ... I don't know.
I have created a ticket #1100 here (https://sourceforge.net/p/codeblocks/tickets/1100/)
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oBFusCATed on May 18, 2021, 09:18:41 pm
This code is the most annoying place in the whole C::B, really.
For me using wx-master, somewhere around 3.1.4-3.1.5-newer, I cannot make it look good at all - it is always smaller. Linux, GTK2.
No combination of Fit/Layout makes it work.
I literally hate this code.
I suppose one day I'll bite the bullet and write a watch control from scratch. How hard could it be!
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oBFusCATed on May 18, 2021, 09:30:07 pm
This code needs major review by someone who understands wxWidgets and sizers and wxPropertyGrid.
There are so many hacks on so many levels. :(  :-[
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oBFusCATed on August 14, 2021, 04:43:47 pm
This topic is about at least two separate issues (both are fixed now in trunk/master).

1. There was a fitting bug which break with the switch to 3.1.5
2. There was a bug which lead to a horizontal scrollbar being visible when the name,value and type of a watched expression are all short.
3. It was possible to expand the tooltip outside of the monitor. Now after an expand the window is clipped, so the content is mostly visible. Unfortunately wxPropGrid behaves strangely - on all ports I've tried the third column is always made visible, which is not what I want, but this is how it is for now.

Please test and report if there are further problems or some regression. Dual monitor setup might be affected more, because I wasn't able to test them.
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: gd_on on August 14, 2021, 07:28:07 pm
Tested on Windows 10 with a compilation via Msys2 in 64 bits.
Looks OK.
Not tested on a dual screen config, sorry, I can't.
Anyway, Many thanks. ;D

gd_on
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oBFusCATed on August 14, 2021, 07:51:10 pm
Please let me know if you find something that bothers you about this.
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: AndrewCot on August 16, 2021, 11:52:04 am
The SVN 12516 code on Windows 10 21H1 patched to the latest as of yesterday and MSYS 2 MinGW64 also updated to latest as of yesterday with dual monitor shows the "Evaluate expression under cursor" when enabled variable data correctly.

Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: AndrewCot on August 16, 2021, 12:36:15 pm
FYI. The display appears to have an extra line which is not very high as per the attachment.
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oBFusCATed on August 16, 2021, 12:50:06 pm
This is intentional to prevent vertical scrollbars.

I think this is the code responsible for this: https://github.com/obfuscated/codeblocks_sf/blob/d2780b0bae3b69c3fa489af2f08f659be075e8a9/src/src/watchesdlg.cpp#L1122-L1125
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: AndrewCot on August 16, 2021, 01:07:12 pm
Have you tried removing it and seeing if there is an issue as the code is 10 years old?
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: oBFusCATed on August 16, 2021, 02:12:39 pm
Nope. These kinds of issues don't resolve themselves just by waiting :)
Title: Re: Display Value Under Cursor - window too small for int variables with short names
Post by: cdx on April 23, 2022, 01:51:45 pm
A workaround for this: increase the font size sufficiently in Settings > Debugger > Common > Value Tolltip Font > Choose.

Samuel posted something which is similar but not exactly the same, so I'm posting as well.

Reading the thread, this is probably fixed for nightly builds but the windows version on the download page (3.1.3) has this issue for me. Posting here for people who try to fix it and get here from a search, as I did. For me font size at or above 12 works well for any case I tried, 11 and below can cause clipping.  If 12 doesn't work for you, maybe 14/20/72/etc will.