Bug 45352 Smart paste garbles indentation of commented code block
Copy this: // int abs(int i) { // //TODO: use Math.abs // if (i > 0) { // return i; // } else { // return -i; // } // } Pasting yields: // int abs(int i) { // //TODO: use Math.abs // if (i > 0) { // return i; // } else { // return -i; // } // }
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
DefaultPartitioner partitioner= new DefaultPartitioner(new FastJavaPartitionScanner(), types);
			partitioner.connect(temp);
			temp.setDocumentPartitioner(IJavaPartitions.JAVA_PARTITIONING, partitioner);
			
			int lines= temp.getNumberOfLines();
			for (int l= document.computeNumberOfLines(prefix); l < lines; l++) { 
				IRegion r= temp.getLineInformation(l);
				lineOffset= r.getOffset();
				
				if (r.getLength() == 0) 
					continue;
				
				String indent= indenter.computeIndentation(lineOffset);
				if (indent == null) 
					return;
				
				
				ITypedRegion partition= temp.getPartition(IJavaPartitions.JAVA_PARTITIONING, lineOffset);
				String type= partition.getType();
				if (type.equals(IJavaPartitions.JAVA_DOC) || type.equals(IJavaPartitions.JAVA_MULTI_LINE_COMMENT))
					if (partition.getOffset() != lineOffset) 
						indent += ' ';
				
				endOfWS= scanner.findNonWhitespaceForwardInAnyPartition(lineOffset, lineOffset + r.getLength());
				if (endOfWS == JavaHeuristicScanner.NOT_FOUND)
					endOfWS= lineOffset + r.getLength();
				
				if (lineOffset < temp.getLength() - 1) {
					
					String s= temp.get(lineOffset, 2);