FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge pull request #4200 from GKFX/autoformat · eodor/processing@701f141 · GitHub

Repository navigation

Commit 701f141

Browse files
committed
Merge pull request processing#4200 from GKFX/autoformat
Fix minor autoformatter bugs. Fixes processing#4185.
2 parents 10baff1 + 34187fe commit 701f141

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎java/src/processing/mode/java/AutoFormat.java‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ public String format(final String source) {
587587
break;
588588
}
589589

590+
// In a simple enum, there's not necessarily a `;` to end the statement.
590591
inStatementFlag = false;
591592

592593
curlyLvl--;
@@ -606,6 +607,7 @@ public String format(final String source) {
606607

607608
trimRight(result);
608609
result.append('\n');
610+
overflowFlag = false; // Would normally be done in writeIndentedLine.
609611
printIndentation();
610612
result.append(c);
611613
if (peek() == ';') result.append(nextChar());
@@ -728,10 +730,14 @@ else if (forFlag) {
728730
inStatementFlag = false;
729731
arrayLevel = -1; // Unlikely to be needed; just in case.
730732

731-
//Same format for case, default, and other labels.
732-
tabs--;
733-
writeIndentedLine();
734-
tabs++;
733+
// Same format for case, default, and other labels.
734+
if (tabs > 0) {
735+
tabs--;
736+
writeIndentedLine();
737+
tabs++;
738+
} else {
739+
writeIndentedLine();
740+
}
735741

736742
readForNewLine();
737743
writeIndentedLine();

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL