From a43b3163d63f2e190f4c49e37ec47d8866364dec Mon Sep 17 00:00:00 2001 From: axelcl Date: Wed, 10 Nov 2004 20:06:25 +0000 Subject: [PATCH 1/1] don't split one line PHP statements in CodeFormatter --- .../phpdt/internal/formatter/CodeFormatter.java | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) 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 bfb0e3b..7caa523 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 @@ -168,6 +168,7 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { , true, /* tokenizeStrings */ null, null); // regular scanner for forming lines scanner.recordLineSeparator = true; + scanner.ignorePHPOneLiner = true; // to remind of the position of the beginning of the line. splitScanner = new Scanner(true /* comment */ , true /* whitespace */ @@ -175,6 +176,7 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { , false /* assert */ , true, /* tokenizeStrings */ null, null); + splitScanner.ignorePHPOneLiner = true; // secondary scanner to split long lines formed by primary scanning // initialize current line buffer currentLineBuffer = new StringBuffer(); @@ -383,6 +385,10 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { newLineCount = 0; } outputCurrentTokenWithoutIndent(Scanner.TokenNameINLINE_HTML, newLineCount); + int srcLen = scanner.source.length; + if (scanner.currentPosition < srcLen-1) { + newLine(1); + } continue; } /* -- 1.7.1