Bug 31323 QuickAssist only wraps 2 lines
build I20030206. 1. Start with the following class public class Test { public static void main(String[] args) { int x = 3; x++; int y=x*x; } } 2. Select the THREE lines of code in the main method. 3. Press ctrl-1 4. If you select any of the quick assists (do, for, if, try, while), only the first TWO lines of the code are inserted. When I selected FOUR lines, still only the first TWO lines were inserted.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/JavaCorrectionAssistant.java
while (iter.hasNext()) {
			IJavaAnnotation annot= (IJavaAnnotation)iter.next();
			Position pos= model.getPosition((Annotation)annot);
			if (isIncluded(pos, startOffset, endOffset)) {
				if (JavaCorrectionProcessor.hasCorrections(annot)) {
					offsetOfFirstProblem= Math.min(offsetOfFirstProblem, pos.getOffset());
					invocationOffset= computeBestOffset(invocationOffset, pos, initialOffset);
					if (initialOffset == invocationOffset)
						return initialOffset;
				}
			}
		}
		if (initialOffset < offsetOfFirstProblem && offsetOfFirstProblem != Integer.MAX_VALUE)
			return offsetOfFirstProblem;
		else
			return invocationOffset;
	}
	private boolean isIncluded(Position pos, int lineStart, int lineEnd) {
		return (pos != null) && (pos.getOffset() >= lineStart && (pos.getOffset() +  pos.getLength() <= lineEnd));
	}
	/**
	 * Computes and returns the invocation offset given a new
	 * position, the initial offset and the best invocation offset
	 * found so far.
	 * <p>
	 * The closest offset to the left of the initial offset is the
	 * best. If there is no offset on the left, the closest on the
	 * right is the best.</p>
	 */
	private int computeBestOffset(int invocationOffset, Position pos, int initalOffset) {