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
* <code>JavaDocAutoIndentStrategy</code>.
	 * 
	 * @param document the document
	 * @param line the line to be indented
	 * @param indenter the java indenter
	 * @param scanner the heuristic scanner
	 * @param commentLines the indent token comment booleans
	 * @param lineIndex the zero-based line index
	 * @return <code>true</code> if the document was modified,
	 *         <code>false</code> if not
	 * @throws BadLocationException if the document got changed concurrently
	 */
	private static boolean indentLine(IDocument document, int line, JavaIndenter indenter, JavaHeuristicScanner scanner, boolean[] commentLines, int lineIndex, int tabSize) throws BadLocationException {
		IRegion currentLine= document.getLineInformation(line);
		final int offset= currentLine.getOffset();
		int wsStart= offset; 
		
		String indent= null;
		if (offset < document.getLength()) {
			ITypedRegion partition= TextUtilities.getPartition(document, IJavaPartitions.JAVA_PARTITIONING, offset, true);
			ITypedRegion startingPartition= TextUtilities.getPartition(document, IJavaPartitions.JAVA_PARTITIONING, offset, false);
			String type= partition.getType();
			if (type.equals(IJavaPartitions.JAVA_DOC) || type.equals(IJavaPartitions.JAVA_MULTI_LINE_COMMENT)) {
				indent= computeJavadocIndent(document, line, scanner);
			} else if (!commentLines[lineIndex] && startingPartition.getOffset() == offset && startingPartition.getType().equals(IJavaPartitions.JAVA_SINGLE_LINE_COMMENT)) {
				
				
				int max= document.getLength() - offset;
				int slashes= 2;
				while (slashes < max - 1 && document.get(offset + slashes, 2).equals(SLASHES))