Bug 561291 - Detail formatter prints with white font?
Summary: Detail formatter prints with white font?
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.16   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2020-03-20 05:10 EDT by Eike Stepper CLA
Modified: 2024-03-09 02:22 EST (History)
1 user (show)

See Also:


Attachments
Screenshot of Detail Formatter configuration (32.63 KB, image/png)
2020-03-20 05:11 EDT, Eike Stepper CLA
no flags Details
Screenshot WITH "wrap text" --> OK (33.47 KB, image/png)
2020-03-21 01:30 EDT, Eike Stepper CLA
no flags Details
Screenshot WITHOUT "Wrap Text" --> NOT OK (14.51 KB, image/png)
2020-03-21 01:31 EDT, Eike Stepper CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eike Stepper CLA 2020-03-20 05:10:47 EDT
In order to debug code that deals with ByteBuffers I configured the Variables view to use the following method:

  public static String dump(ByteBuffer byteBuffer)
  {
    final int position = byteBuffer.position();
    final int limit = byteBuffer.limit();

    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < limit; i++)
    {
      int b = byteBuffer.get(i) & 0xFF; // Dump unsigned int instead of signed byte.
      builder.append(' '); // Normal space.
      builder.append(b);
    }

    return "pos " + position + "/" + limit + ":" + builder;
  }

But I can only see the first few bytes being printed to the detail pane. When I "Select All" the text in the detail pane and copy/paste it to a separate text editor all the expected content appears. I.e., my detail formatter produces a lot of content and all that content is in the detail pane, but at some early position the content is kind of rendered with a white foreground font.

The problem goes away when I produce non-breakable spaces instead of the normal spaces like so:

  public static String dump(ByteBuffer byteBuffer)
  {
    final int position = byteBuffer.position();
    final int limit = byteBuffer.limit();

    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < limit; i++)
    {
      int b = byteBuffer.get(i) & 0xFF; // Dump unsigned int instead of signed byte.
      builder.append('\u00A0'); // NO-BREAK SPACE. A bug in JDT's detail formatter hates normal spaces.
      builder.append(b);
    }

    return "pos\u00A0" + position + "/" + limit + ":" + builder;
  }

Very weird...
Comment 1 Eike Stepper CLA 2020-03-20 05:11:28 EDT
Created attachment 282163 [details]
Screenshot of Detail Formatter configuration
Comment 2 Sarika Sinha CLA 2020-03-20 23:59:59 EDT
If someone can look into this we can review the patch.
Comment 3 Eike Stepper CLA 2020-03-21 01:30:11 EDT
I have no resources to fix this problem but I can provide some new observations that may help you to fix it:

1) If I turn on "Show Whitespace Characters" in a text editor, then normal spaces in the detail pane are decorated with the gray dots. The text between the spaces stays white/invisible.

2) If I turn on "Wrap Text" in the detail pane then the entire problem goes away and the entire detail string is rendered correctly/visibly.

I'm going to attach two more screenshots, one with Wrap Text and one without...
Comment 4 Eike Stepper CLA 2020-03-21 01:30:52 EDT
Created attachment 282171 [details]
Screenshot WITH "wrap text" --> OK
Comment 5 Eike Stepper CLA 2020-03-21 01:31:16 EDT
Created attachment 282172 [details]
Screenshot WITHOUT "Wrap Text" --> NOT OK
Comment 6 Eclipse Genie CLA 2022-03-12 18:39:48 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 7 Eclipse Genie CLA 2024-03-09 02:22:09 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.