Bug 304705 - [formatter] Unexpected indentation of wrapped line comments when 'Never indent line comment on first column' preference is checked
Summary: [formatter] Unexpected indentation of wrapped line comments when 'Never inden...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M6   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-04 12:13 EST by Frederic Fusier CLA
Modified: 2010-03-08 13:36 EST (History)
1 user (show)

See Also:


Attachments
Proposed patch (3.21 KB, patch)
2010-03-04 12:35 EST, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Fusier CLA 2010-03-04 12:13:52 EST
While testing UI for bug 251133, I saw a weird behavior of the formatter when the 'Never indent line comment on first column' is activated.

The example is:
interface Example {
// This is a long comment    with	whitespace     that should be split...
	int foo3();
...
}

When checking the 'Never indent line comment on first column' preference, I got this output:

interface Example {
// This is a long comment with whitespace that should be split in multiple line
	// comments in case the line comment formatting is enabled
	int foo3();
...
}

Which first looks really weird. As the comment is on first column, I would expect the formatter to set the wrapped line comments also on the first column, hence I should get the following output:

interface Example {

// This is a long comment with whitespace that should be split in multiple line
// comments in case the line comment formatting is enabled
	int foo3();
...
}
Comment 1 Frederic Fusier CLA 2010-03-04 12:15:33 EST
Note that this is not a regression introduced by the fix for bug 251133 as I get the same behavior in 3.6M5...
Comment 2 Frederic Fusier CLA 2010-03-04 12:21:02 EST
In fact this is a regression introduced while re-writing the formatter for comments... It worked properly in 3.3.2 but was broken in 3.4.0..
Comment 3 Frederic Fusier CLA 2010-03-04 12:35:49 EST
Created attachment 160980 [details]
Proposed patch

Fix is trivial, just do not indent while wrapping the comment line if the preference is set...
Comment 4 Frederic Fusier CLA 2010-03-05 02:55:26 EST
(In reply to comment #3)
> Created an attachment (id=160980) [details]
> Proposed patch
> 
Released for 3.6M6 in HEAD stream.
Comment 5 Olivier Thomann CLA 2010-03-08 13:36:38 EST
Verified for 3.6M6 using I20100307-2000.