Bug 328705 - [nls tooling] Hover over externalized non-ascii string and focus does not show the string correctly if it contains \t
Summary: [nls tooling] Hover over externalized non-ascii string and focus does not sho...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-26 09:31 EDT by Raksha Vasisht CLA
Modified: 2022-12-02 10:14 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Raksha Vasisht CLA 2010-10-26 09:31:10 EDT
I20101025-1800.
Consider the example below: 

package pack;
public class Snippet {
    public static void main(String[] args) {
        p("Hello \\b\\t\\f\\r\\n\\\\:\\!\\# !# \b\t\f\r\n\\"); //$NON-NLS-1$
        p("Hello \\b\\t\\f\\r\\n\\\\:\\!\\# !# \b\t\f\r\n\\");

        p("\t\tHello \u00e4 \u2603, \\u00e4 \\u2603, \\u"); //$NON-NLS-1$
        p("\t\tHello \u00e4 \u2603, \\u00e4 \\u2603, \\u");
    }
    private static void p(String s) {
        System.out.println(s);
    }
}
1) Externalize the strings in the example and hover over both the strings : it shows the appropriate strings : good
2) Now bring focus into the hover, 
= > works okay with the first string but half the string is pushed down and only visible partially for the second one.
Comment 1 Deepak Azad CLA 2010-10-26 10:01:21 EDT
org.eclipse.jface.text.DefaultInformationControl.setInformation(String) line 317 : problem is different(smaller) size constraints when the hover is focused. And then HTMLTextPresenter fits the hover text in this smaller area. 

I will take a look.
Comment 2 Deepak Azad CLA 2010-10-26 15:05:46 EDT
(In reply to comment #1)
> org.eclipse.jface.text.DefaultInformationControl.setInformation(String) line
> 317 : problem is different(smaller) size constraints when the hover is focused.
Ok, while the above is correct, this different size is the actual size of the hover shell. So this is not a problem. (When the hover is not focused a large size is returned)

The problem is presence of \t in the string. Try with a very long value which does not contain \t. 
e.g. "This is a very long but simple value. It should work correctly, as is does not have any tab character. To break this as well add a tab character anywhere in this."

With this string the hover behaves perfectly, but misbehaves when a \t is added in between.

Problematic code : LineBreakingReader.findNextBreakOffset(int) line : 99 
> int wordWidth= fGC.textExtent(word).x;
for a \t character the text extent is returned as 40 (pixels), but in the UI a \t uses only 10 pixels. This just messes up the hover. 

I do not know why there is a difference in the 2 values..
Comment 3 Deepak Azad CLA 2010-11-09 04:53:37 EST
> Problematic code : LineBreakingReader.findNextBreakOffset(int) line : 99 
> > int wordWidth= fGC.textExtent(word).x;
> for a \t character the text extent is returned as 40 (pixels), but in the UI a
> \t uses only 10 pixels. This just messes up the hover. 
> 
> I do not know why there is a difference in the 2 values..
The problem looks to be in our code and not in SWT. See Snippet93 (SWT snippet), it computes and draws 40 pixels there.
Comment 4 Eclipse Genie CLA 2020-07-17 18:33:10 EDT
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 5 Eclipse Genie CLA 2022-12-02 10:14:59 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.