From: bananeweizen Date: Tue, 20 Dec 2005 00:58:53 +0000 (+0000) Subject: bug 1274348, superfluous newline at file end on formatting source X-Git-Url: http://git.phpeclipse.com bug 1274348, superfluous newline at file end on formatting source --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java index 6003bd0..5d8db07 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java @@ -271,7 +271,7 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { outputLine(currentString, false, currentLineIndentationLevel, 0, -1, null, 0); } int scannerSourceLength = scanner.source.length; - if (scannerSourceLength > 2) { + if ((scannerSourceLength > 2) && (scanner.startPosition < scannerSourceLength)) { if (scanner.source[scannerSourceLength - 1] == '\n' && scanner.source[scannerSourceLength - 2] == '\r') { formattedSource.append(options.lineSeparatorSequence); increaseGlobalDelta(options.lineSeparatorSequence.length - 2);