bug 1274348, superfluous newline at file end on formatting source
authorbananeweizen <bananeweizen>
Tue, 20 Dec 2005 00:58:53 +0000 (00:58 +0000)
committerbananeweizen <bananeweizen>
Tue, 20 Dec 2005 00:58:53 +0000 (00:58 +0000)
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java

index 6003bd0..5d8db07 100644 (file)
@@ -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);