From 39b9490e165600092f8692f4efc5fd482d28e98b Mon Sep 17 00:00:00 2001 From: axelcl Date: Tue, 9 Nov 2004 21:58:18 +0000 Subject: [PATCH] no indentation of HTML and phpdocs --- .../phpdt/internal/formatter/CodeFormatter.java | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 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 b272fbd..bfb0e3b 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 @@ -370,11 +370,19 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } token = 0; } - if (token == Scanner.TokenNameEOF) + if (token == Scanner.TokenNameEOF) { break; - if (token == Scanner.TokenNameHEREDOC || token == Scanner.TokenNameINLINE_HTML) { + } else if (token == Scanner.TokenNameHEREDOC) { // no indentation for heredocs and HTML ! - outputCurrentTokenWithoutIndent(Scanner.TokenNameHEREDOC); + outputCurrentTokenWithoutIndent(Scanner.TokenNameHEREDOC, 0); + continue; + } else if (token == Scanner.TokenNameINLINE_HTML) { + // no indentation for heredocs and HTML ! + int newLineCount = 1; + if (scanner.startPosition==0) { + newLineCount = 0; + } + outputCurrentTokenWithoutIndent(Scanner.TokenNameINLINE_HTML, newLineCount); continue; } /* @@ -1449,8 +1457,8 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } } - private void outputCurrentTokenWithoutIndent(int token) { - newLine(0); + private void outputCurrentTokenWithoutIndent(int token, int newLineCount) { + newLine(newLineCount); formattedSource.append(scanner.source, scanner.startPosition, scanner.currentPosition - scanner.startPosition); } -- 1.7.1