Author Topic: debugger plugin's tip windows does not show content with horizontal scroll bar  (Read 11134 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6121
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Hi, if the horizontal scroll bar exists, the content get covered, see the 2 images in the attachment.
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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2898
This is caused when the popup window size is wider than the space left to the right edge of the parent window.

For example: When this happens, move the editor window to the left to allow room for the full popup window. Show the data again,
then the popup window will show correctly.

I know this isn't a fix. ..just sayin'...
« Last Edit: October 22, 2025, 07:45:31 am by Pecan »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6121
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Thanks. Can we dynamically change the outer window size? Well, we still need to find a way to fix such issue, though this is not a big issue.  :)
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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6121
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Not the debug tip window, sometimes, the code completion tip(from the clangd_client plugin) window becomes extremely large, see the blow two screen shot, the tip window cover the whole C::B window, also the tip window extended to another screen.  :(
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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2898
Not the debug tip window, sometimes, the code completion tip(from the clangd_client plugin) window becomes extremely large, see the blow two screen shot, the tip window cover the whole C::B window, also the tip window extended to another screen.  :(

 Is there any way you could tell me what "auto" actually is or give me an example as to how to re-create the situation you're showing here?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6121
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Is there any way you could tell me what "auto" actually is or give me an example as to how to re-create the situation you're showing here?

You can simply do this:

1, clone the code repo or download the zip file:  asmwarrior/parserlib: A c++ recursive-descent PEG parsing library that supports left recursion..

2, open the cbp project in the root folder: https://github.com/asmwarrior/parserlib/blob/master/test_parser_lib.cbp

3, open the file: cpp_lexer_grammar.h in the C::B editor

4, you can use clangd_client, and use the mouse to hover the "token" variable in the line 172

5, you will see a very big tip window which cover the whole screen, note I only tested on Windows 10 OS.

Thanks.
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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2898
Here is Gemini-CLI's evaluation of the problem.
Quote
| SearchText 'ShowValueTooltip' within src |
| |
| Found 13 matches |

    ShowValueTooltip is called from two key locations. First, sdk/ccmanager.cpp checks if a tooltip can be shown when the user hovers over a
    variable. If so, a command is sent to GDB. After GDB returns the variable's value, the GDB command in plugins/debuggergdb/gdb_commands.h calls
    ShowValueTooltip a second time to actually display the tooltip. The call chain starts with CodeCompletionManager, goes through the debugger
    plugin, gets the value from GDB, then DebuggerManager, and finally DebugInterfaceFactory creates the tooltip window. The key call sites are
    sdk/ccmanager.cpp and plugins/debuggergdb/gdb_commands.h.

    [pecan prompt ]There is a problem when the debugger shows a single line value that is too long and hits the right side of the display. The bottom scroll bar
    overlays the value being displayed. The window created is not tall enough to contain both the value and the bottom scroll bar. I want to know
    where the window is created and why it isn't tall enough.

[Gemini response]
    The value tooltip window sizing appears faulty, obscuring long text with a scrollbar. I'll investigate src/src/watchesdlg.cpp, focusing on the
    ValueTooltip class, especially GridSetMinSize and UpdateSizeAndFit functions, and the usage of wxPopupWindow and wxScrolledWindow. I suspect a
    height miscalculation in GridSetMinSize or an incorrect virtual size setting. My first step is to reread src/src/watchesdlg.cpp.

| ReadFile src\src\watchesdlg.cpp |
| |

    After re-reading src/src/watchesdlg.cpp and analyzing the ValueTooltip class, I've pinpointed the sizing issue.

    ValueTooltip Sizing Analysis

    The ValueTooltip window is created in its constructor and sized primarily by the GridSetMinSize function. This function calculates the necessary
    height and width for the wxPropertyGrid that displays the value.

    The issue lies in how the height and width are determined, especially when a horizontal scrollbar is needed.

        Height Calculation: The window's height is determined by the content of the wxPropertyGrid.

        Width and Scrollbar: When the text content is too wide for the display, GridSetMinSize correctly calculates that a horizontal scrollbar is
        needed and sets a virtualWidth.

        The Flaw: The crucial oversight is that after deciding to add a horizontal scrollbar, the function does not increase the calculated height of
        the window to accommodate the scrollbar itself.

    Conclusion

        Where the window is created: The ValueTooltip window is created in its constructor within src/src/watchesdlg.cpp.

        Why it isn't tall enough: The sizing logic in the GridSetMinSize function in the same file fails to account for the vertical space taken up by
        the horizontal scrollbar when it becomes necessary for long lines of text. The window is sized for the text only, so the scrollbar ends up
        drawn on top of the last line of text.

    To fix this, the code would need to be modified to add the height of a horizontal scrollbar to the total height of the ValueTooltip whenever one
    is displayed.

I'll follow up on this.
« Last Edit: Today at 12:23:14 am by Pecan »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6121
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Thanks.
Al is so smart to analysis long code.  It has a very large memory. I think it is at least better than me.
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.