Bug 99738 - [formatting] each format shifts code inside <pre> one space to the right
Summary: [formatting] each format shifts code inside <pre> one space to the right
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal with 6 votes (vote)
Target Milestone: 3.2.2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 96268 106262 110787 113545 114257 116437 116443 118140 119439 130724 147291 151457 153419 154027 157540 161184 164259 169330 171485 178432 194533 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-13 13:26 EDT by Dani Megert CLA
Modified: 2007-07-04 11:04 EDT (History)
27 users (show)

See Also:


Attachments
Proposed fix (996 bytes, patch)
2007-01-05 11:04 EST, Olivier Thomann CLA
no flags Details | Diff
Regression tests (5.21 KB, patch)
2007-01-05 11:04 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2005-06-13 13:26:01 EDT
3.1 RC2

This happens with or without the fix for bug 52921. Examples see there.
Comment 1 Olivier Thomann CLA 2005-06-13 15:11:10 EDT
This seems to fail for the same kind of reason as bug 52921.
If the code contains a space after the '*', a new space gets added.
Comment 2 Stefan Matthias Aust CLA 2005-06-15 01:36:14 EDT
It not only shifts everything one space to the right, it also adds an empty line
before and after the text which is even more anoying.

It seems that

 <pre>
 whatever
 </pre>

stays okay while

 <pre>
 whatever
 whatever
 </pre>

starts moving...
Comment 3 Dani Megert CLA 2005-06-15 02:08:24 EDT
Please read comment 0 and bug 52921 mentioned there.
Comment 4 Stefan Matthias Aust CLA 2005-06-18 04:36:52 EDT
I just checked I20050617-1618 and inserting new lines is gone but non-Java-code
is still shifted to the right with every format operation. Switching off "Format
Java code snippets" will help.  

BTW, at the beginning, I didn't notice that "Format Java code snippets" will
affect <pre> elements so it might be a good idea to make this explicit in the
text, i.e. "Format Java code snippets inside <pre> tags"
Comment 5 Dani Megert CLA 2005-06-19 11:27:29 EDT
*** Bug 96268 has been marked as a duplicate of this bug. ***
Comment 6 Louis-Dominique Dubeau CLA 2005-07-21 19:03:33 EDT
The spacing problem remaining as of comment 4 still happens with:

Version: 3.1.0
Build id: I20050627-1435

Besides the snippets mentioned in earlier comments, the following text also
triggers the problem:

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

Formatting this snippet repeatedly adds a space in front of &lt; with each
iteration.  Going by comment 2 (which is entirely correct), one might infer that
<pre> elements with only one line of content do not trigger the bug but as the
case above illustrates, it is not the case for *all* one-line <pre> elements.

Like in previous cases, turning off "Format Java code snippets" also prevents
the bug to show up with the snippet above.
Comment 7 Dani Megert CLA 2005-08-04 06:20:41 EDT
>The spacing problem remaining as of comment 4 still happens with:
Please take a look at https://bugs.eclipse.org/bugs/page.cgi?id=fields.html#status
Comment 8 Dani Megert CLA 2005-08-08 05:05:11 EDT
*** Bug 106262 has been marked as a duplicate of this bug. ***
Comment 9 Tom Hofmann CLA 2005-09-27 08:25:37 EDT
*** Bug 110787 has been marked as a duplicate of this bug. ***
Comment 10 Dani Megert CLA 2005-10-10 12:53:57 EDT
Ownership changed.
Comment 11 Tom Hofmann CLA 2005-10-31 04:21:16 EST
*** Bug 114257 has been marked as a duplicate of this bug. ***
Comment 12 Stefan Küttner CLA 2005-11-01 03:27:18 EST
*** Bug 113545 has been marked as a duplicate of this bug. ***
Comment 13 Olivier Thomann CLA 2005-11-15 10:05:08 EST
*** Bug 116437 has been marked as a duplicate of this bug. ***
Comment 14 Olivier Thomann CLA 2005-11-15 10:30:32 EST
*** Bug 116443 has been marked as a duplicate of this bug. ***
Comment 15 Olivier Thomann CLA 2005-11-28 20:54:54 EST
*** Bug 118140 has been marked as a duplicate of this bug. ***
Comment 16 Dani Megert CLA 2005-12-06 12:48:04 EST
*** Bug 119439 has been marked as a duplicate of this bug. ***
Comment 17 Tom Hofmann CLA 2006-03-07 08:50:33 EST
*** Bug 130724 has been marked as a duplicate of this bug. ***
Comment 18 Olivier Thomann CLA 2006-06-15 12:57:09 EDT
*** Bug 147291 has been marked as a duplicate of this bug. ***
Comment 19 Dani Megert CLA 2006-07-22 12:11:31 EDT
*** Bug 151457 has been marked as a duplicate of this bug. ***
Comment 20 Olivier Thomann CLA 2006-08-13 19:50:23 EDT
*** Bug 153419 has been marked as a duplicate of this bug. ***
Comment 21 Dani Megert CLA 2006-08-16 05:04:42 EDT
*** Bug 154027 has been marked as a duplicate of this bug. ***
Comment 22 Olivier Thomann CLA 2006-09-15 20:02:13 EDT
*** Bug 157540 has been marked as a duplicate of this bug. ***
Comment 23 Volker Renneberg CLA 2006-09-26 08:30:12 EDT
Well, so what happens with this bug? It has been detected in 3.1 and still can be found in 3.2. Is there any plan to fix it in 3.3?

Please keep in mind, that documentation is very important and shall not be inhibited by tedious bugs like this.
Comment 24 Olivier Thomann CLA 2006-09-26 09:29:40 EDT
Yes, this is intended to be fixed for 3.3. Right now I have to focus on other things. But if you want to provide a patch, I'll review it.
Comment 25 Dani Megert CLA 2006-10-17 03:41:26 EDT
*** Bug 161184 has been marked as a duplicate of this bug. ***
Comment 26 Olivier Thomann CLA 2006-11-12 14:18:09 EST
*** Bug 164259 has been marked as a duplicate of this bug. ***
Comment 27 Mike Wilson CLA 2006-12-18 11:33:51 EST
Olivier, is there any chance we can fix this for 3.2.2? From the number of dups, it seems like it's really causing grief for people.
Comment 28 Olivier Thomann CLA 2006-12-18 20:18:42 EST
I can investigate a fix. A solution for 3.2.2 will depend on the risk involved with the fix. I cannot make any promise for 3.2.2 for now.
Comment 29 Andrew Cowie CLA 2007-01-02 08:30:08 EST
Risk? This bug means that no one can put code examples in their JavaDoc! Certainly in our project we're endeavouring to do that as we have many users who are new to the GUI toolkit we present and so need to embed all kinds of code snippets. At the moment, every time you hit code format, everything precesses to the right one character, and your version control tool thinks you've got a change on those lines. Endlessly removing single space characters manually is getting really really old. Is there any shred of hope you can offer us?

AfC
Maintainer
java-gnome.sourceforge.net
Comment 30 Dani Megert CLA 2007-01-02 09:48:02 EST
*** Bug 169330 has been marked as a duplicate of this bug. ***
Comment 31 Olivier Thomann CLA 2007-01-05 10:20:33 EST
(In reply to comment #29)
> Risk? This bug means that no one can put code examples in their JavaDoc!
I know. I'll investigate a fix.
Comment 32 Olivier Thomann CLA 2007-01-05 11:02:54 EST
Any volunteer to try a patch?
Comment 33 Olivier Thomann CLA 2007-01-05 11:04:31 EST
Created attachment 56462 [details]
Proposed fix

This patch seems to work fine for test cases issued from this bug and its duplicates.
Comment 34 Olivier Thomann CLA 2007-01-05 11:04:44 EST
Created attachment 56463 [details]
Regression tests
Comment 35 Olivier Thomann CLA 2007-01-05 12:52:32 EST
Released for 3.3 M5 in HEAD stream

Released for 3.2.2 in R3_2_maintenance stream
Comment 36 Olivier Thomann CLA 2007-01-06 18:03:06 EST
You can pick up the update on:
http://www.eclipse.org/jdt/core/r3.2/index.php#UPDATES
and replace the jdt.core plugin in the latest 3.2 maintenance stream.

Let me know asap if you find any problem.
Comment 37 Philipe Mulet CLA 2007-01-08 04:42:04 EST
+1 for 3.2.2.
Comment 38 Andrew Cowie CLA 2007-01-08 06:03:54 EST
I just tested it, and it appears to work perfectly now.

AfC
Comment 39 Maxime Daniel CLA 2007-01-15 23:43:42 EST
The behavior of build M20070112-1200 on the test case of comment #6 is not perfect, but it is different from the one which triggered this bug. I opened the fup bug 170580 to track that separate issue.
The original defect is fixed.
Verified for 3.2.2 using build M20070112-1200.
Comment 40 Maxime Daniel CLA 2007-01-16 03:03:49 EST
*** Bug 106262 has been marked as a duplicate of this bug. ***
Comment 41 Maxime Daniel CLA 2007-01-16 03:07:31 EST
*** Bug 114257 has been marked as a duplicate of this bug. ***
Comment 42 Maxime Daniel CLA 2007-01-16 03:08:39 EST
*** Bug 110787 has been marked as a duplicate of this bug. ***
Comment 43 Maxime Daniel CLA 2007-01-16 03:10:25 EST
*** Bug 130724 has been marked as a duplicate of this bug. ***
Comment 44 Maxime Daniel CLA 2007-01-16 03:13:35 EST
*** Bug 114257 has been marked as a duplicate of this bug. ***
Comment 45 Benno Baumgartner CLA 2007-01-24 03:39:49 EST
*** Bug 171485 has been marked as a duplicate of this bug. ***
Comment 46 Eric Jodet CLA 2007-02-06 02:41:20 EST
Verified for 3.3 M5 using build I20070205-0009
Comment 47 Olivier Thomann CLA 2007-03-20 19:55:26 EDT
*** Bug 178432 has been marked as a duplicate of this bug. ***
Comment 48 Olivier Thomann CLA 2007-07-04 11:04:21 EDT
*** Bug 194533 has been marked as a duplicate of this bug. ***