Bug 41692 Pressing Enter at last caret position does not work
I20030819 This is in .log: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: assertion failed; at org.eclipse.jdt.internal.corext.Assert.isTrue(Assert.java:136) at org.eclipse.jdt.internal.corext.Assert.isTrue(Assert.java:121) at org.eclipse.jdt.internal.ui.text.java.JavaAutoIndentStrategy.firstNonWhitespaceBackward(JavaAutoIndentStrategy.java:501) at org.eclipse.jdt.internal.ui.text.java.JavaAutoIndentStrategy.isBracelessBlockStart(JavaAutoIndentStrategy.java:359) at org.eclipse.jdt.internal.ui.text.java.JavaAutoIndentStrategy.smartIndentAfterNewLine(JavaAutoIndentStrategy.java:330) at org.eclipse.jdt.internal.ui.text.java.JavaAutoIndentStrategy.customizeDocumentCommand(JavaAutoIndentStrategy.java:1187) at org.eclipse.jface.text.TextViewer.customizeDocumentCommand(TextViewer.java:3080) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.customizeDocumentCommand(CompilationUnitEditor.java:214) at org.eclipse.jface.text.TextViewer.handleVerifyEvent(TextViewer.java:3099) at org.eclipse.jface.text.TextViewer$TextVerifyListener.verifyText(TextViewer.java:318) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:189) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:848) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:872) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:857) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:665) at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:5808) at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:6794) at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2546) at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5187) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5210) at org.eclipse.swt.custom.StyledText$8.handleEvent(StyledText.java:4957) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:848) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:872) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:857) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1688) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1684) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3013) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2892) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2713) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1338) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1876) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1676) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1659) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:858) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:291) at org.eclipse.core.launcher.Main.run(Main.java:747) at org.eclipse.core.launcher.Main.main(Main.java:583)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
* that its last character is at <code>position</code>. If <code>like</code> starts with a
	 * identifier part (as determined by {@link Character.isJavaIdentifier(char)}), it is also made
	 * sure that <code>like</code> is preceded by some non-identifier character or stands at the
	 * document start.
	 * 
	 * @param document the document being modified
	 * @param position the first character position in <code>document</code> to be considered
	 * @param like the <code>String</code> to look for.
	 * @return <code>true</code> if  <code>document</code> contains <code>like</code> such that it ends at <code>position</code>, <code>false</code> otherwise
	 */
	private static boolean looksLike(IDocument document, int position, String like) {
		int length= like.length();
		if (position < length - 1)
			return false;
		try {
			if (!like.equals(document.get(position - length + 1, length)))
				return false;
			if (position >= length && Character.isJavaIdentifierPart(like.charAt(0)) && Character.isJavaIdentifierPart(document.getChar(position - length)))
				return false;
		} catch (BadLocationException e) {
			return false;
		}
		return true;
	}
	/**
	 * Computes an insert position for an opening brace if <code>offset</code> maps to a position in
	 * <code>document</code> with a expression in parenthesis that will take a block after the closing parenthesis.
	 * 
	 * @param document the document being modified
	 * @param offset the offset of the caret position, relative to the line start.