Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 332737

Summary: [typing] pasting line comments at column 0 eats space before text
Product: [Eclipse Project] JDT Reporter: Stephan Herrmann <stephan.herrmann>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: ASSIGNED --- QA Contact:
Severity: minor    
Priority: P3 CC: daniel_megert, ms
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Stephan Herrmann CLA 2010-12-16 08:58:53 EST
This is 3.7M4, a fresh Java project with simple Java class:

public class CommentFormatting {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=332637 
// Dead Code detection removing code that isn't dead
public void test() {
	
}
}

Now select the method test() including the preceding line comments
and paste it immediately after the method. The result will be:

public class CommentFormatting {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=332637 
// Dead Code detection removing code that isn't dead
public void test() {
	
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=332637 
//Dead Code detection removing code that isn't dead
public void test() {
	
}
}

The problem only occurs if the comment is pasted behind a method that
is not indented.
Comment 1 Deepak Azad CLA 2011-01-22 06:47:58 EST
*** Bug 335085 has been marked as a duplicate of this bug. ***
Comment 2 Stephan Herrmann CLA 2012-01-12 07:37:03 EST
Still relevant in HEAD. In most of JDT/Core's test classes this means
cut/copy and paste deletes a space which needs to be re-added manually
or risk wasting cycles during code review.
Comment 3 Eclipse Genie CLA 2019-08-31 13:25:55 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 4 Stephan Herrmann CLA 2019-08-31 13:32:09 EDT
This happens. No big deal but causes a little hick-up in the editing flow.
Comment 5 Eclipse Genie CLA 2021-08-23 15:26:33 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 6 Eclipse Genie CLA 2023-08-19 11:37:16 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.