Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 102812 - Copied single line comments not aligned
Summary: Copied single line comments not aligned
Status: RESOLVED DUPLICATE of bug 65841
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-06 03:43 EDT by Erol Koç CLA
Modified: 2006-02-17 03:34 EST (History)
0 users

See Also:


Attachments
Screenshot of comment in editor (11.72 KB, image/gif)
2006-02-16 15:49 EST, Erol Koç CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Erol Koç CLA 2005-07-06 03:43:27 EDT
using I20050627-1435

If I copy a single line comment from one line to another, the comment is not
properly aligned to the code. Example:

public void foo() {
   // some comment which I try to copy to the line after the int
   int x;
}

results in:

public void foo() {
   // some comment which I try to copy to the line after the int
   int x;
//  some comment which I try to copy to the line after the int
}
Comment 1 Dani Megert CLA 2005-07-06 04:12:48 EDT
We use the formatter for this. Can you try to:
1. format your code
2. retry your example?
Comment 2 Erol Koç CLA 2005-07-06 06:22:02 EDT
Could you be a little bit more specific about how to specify this in the
Formatter? I can't find any suitable option for this issue.
Comment 3 Dani Megert CLA 2005-07-06 06:57:59 EDT
Not sure what concrete setting makes the difference. For example tabs/spaces
setting could be the problem: the code you pasted in comment 0 uses spaces for
indentation while the default formatter setting is to use (4) tabs only.
Comment 4 Erol Koç CLA 2005-07-06 07:46:48 EDT
I did not copy the code directly from Eclipse but just typed in some example to
indicate what the problems are. I just used 4 spaces to align the code somehow
(and surely: Eclipse would use some other identation). The Example was just
meant to give a an idea of what the problem is.

Maybe you should try to copy one comment line in your texteditor and paste it
into another line to see what happens.
Comment 5 Dani Megert CLA 2005-07-06 07:56:42 EDT
That's what I did, so maybe you provide your real steps so that we can reproduce ;-)

See also:
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-text-home/development/bug-incomplete.htm
Comment 6 Erol Koç CLA 2005-07-06 08:21:05 EDT
Steps to reproduce:

1. Write a function like this:
	public void foo() {
		// some comment
		int x;
	}

2. Select the comment with your mouse starting from the first slash character up
to the last charachter of the comment
3. Copy the selected comment using Ctrl+c
4. Put your cursor right after the semicolon of the x definition and press enter
to get a new line
5. Use Ctrl+v to insert the copied comment to this line
6. You should now have something that looks like this:
	public void foo() {
		// some comment
		int x;
//		 some comment
	}

What I claim is that I would like the comment to be at the same position like
the first original comment (this is having the same indentation).

I can reproduce this as many times as I want and I also tried it out on another
machine (running the same Eclipse version).

Please note that the above code was directly copied from Eclipse and that the
default Eclipse formatter settings are used.

If you do not get the same result is I do, it might be the case that you already
fixed this bug in your latest integration build...

Can you comment on that?
Comment 7 Erol Koç CLA 2006-02-16 15:49:38 EST
Created attachment 34874 [details]
Screenshot of comment in editor

To make my point even clearer, I made a screenshot of the editor before and after copying the comment. But see for yourself.
Comment 8 Erol Koç CLA 2006-02-16 15:50:50 EST
Dani, could you please have a look at this again? Thank you!
Comment 9 Dani Megert CLA 2006-02-17 03:34:21 EST
>2. Select the comment with your mouse starting from the first slash character up
Here we go! Up to know you always spoke about "line" and not that you started the selection at '/'. Could have saved us some time ;-)



*** This bug has been marked as a duplicate of 65841 ***