Bug 107128 [typing] Move lines destroys indentation of outcommented code
I20050811-1530 Move lines destroys the indentation of code that has been commented out. IMO, Move lines should never try to be smart about the contents of a commented section. It should just add/remove whitespace in front of the // (same behavior as when moving other statements). public class Klass { int bar; // void foo() { // System.out.println("foo"); // } } - select the 3 commented lines - press Alt+Up -> document looks like this (note the removed tab in fromt of System.out.pr...): public class Klass { // void foo() { // System.out.println("foo"); // } int bar; }
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/IndentUtil.java
return new IndentResult(null);
		
		result= reuseOrCreateToken(result, numberOfLines);
		result.hasChanged= false;
		
		JavaHeuristicScanner scanner= new JavaHeuristicScanner(document);
		JavaIndenter indenter= new JavaIndenter(document, scanner, project);
		
		String current= getCurrentIndent(document, lines.getStartLine());
		StringBuffer correct= indenter.computeIndentation(document.getLineOffset(lines.getStartLine()));
		if (correct == null)
			return result; 
		
		int tabSize= CodeFormatterUtil.getTabWidth(project);
		StringBuffer addition= new StringBuffer();
		int difference= subtractIndent(correct, current, addition, tabSize);
		
		if (difference == 0)
			return result;
			
		if (result.leftmostLine == -1)
			result.leftmostLine= getLeftMostLine(document, lines, tabSize);
		
		int maxReduction= computeVisualLength(getCurrentIndent(document, result.leftmostLine + lines.getStartLine()), tabSize);
		
		if (difference > 0) {
			for (int line= lines.getStartLine(), last= line + numberOfLines, i= 0; line < last; line++)
				addIndent(document, line, addition, result.commentLinesAtColumnZero, i++);
		} else {
			int reduction= Math.min(-difference, maxReduction);