Bug 170580 - [formatter] extraneous white space in <pre> one-line block
Summary: [formatter] extraneous white space in <pre> one-line block
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.1   Edit
Hardware: PC All
: P5 minor (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2007-01-15 23:28 EST by Maxime Daniel CLA
Modified: 2020-02-16 09:12 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Daniel CLA 2007-01-15 23:28:26 EST
Build M20060921-0945.
This is fup on bug 99738. The effect of the formatter on the example given in comment #6 is the following:
	/*
<pre>
&lt;test&gt;
</pre>
	 */

becomes:
	/*
	 * <pre> &lt;test&gt; </pre>
	 */

Notice the extra white space between the <pre> and the first &, which will result into a leading white space in the rendered HTML result.
Unlike bug 99738, further format operations no more shift the result to the right.
Comment 1 Frederic Fusier CLA 2008-08-18 08:07:40 EDT
Ownership has changed for the formatter, but I surely will not have enough time to fix your bug during the 3.5 development process, hence set its priority to P5.
Please provide a patch if you definitely need the bug to be fixed in this version and I'll have a look at it...
TIA
Comment 2 Jaime Hablutzel CLA 2010-08-29 01:23:55 EDT
What is the expected behaviour after formatting something like:

<pre>\n&lt;test&gt;\n</pre>

Is this?

<pre>&lt;test&gt;</pre>

What about and the extra space after the first newline?

<pre>\n &lt;test&gt;\n</pre>

I think I could create a patch after clarifying this.
Comment 3 Frederic Fusier CLA 2010-08-30 06:34:46 EDT
I think this is no longer a problem using 3.6.0...
The following test case:
public class X {
    /**
<pre>
&lt;test&gt;
</pre>
     */
	public void foo() {}
}

Is currently formatted as follow:

public class X {
	/**
	 * <pre>
	 * &lt;test&gt;
	 * </pre>
	 */
	public void foo() {
	}
}

I thought it was the correct behavior while fixing bug 305518. However, it seems that javadoc does not behaves the same as it does not generate exactly the same thing for:
    /**
<pre>
&lt;test&gt;
</pre>
     */
than for:
	/**
	 * <pre>
	 * &lt;test&gt;
	 * </pre>
	 */

The difference is a space before the line in the generated method detail... Hence, it seems that javadoc considers that the space after the '*' belongs to the line, although our formatter does not...

So, we can use this bug for this peculiar issue follow-up although the current formatter behavior is now different than the one described in comment 0...

Of course a patch (including JUnit tests) is more than welcome :-)
Comment 4 Eclipse Genie CLA 2020-02-16 09:12:16 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.