Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomassetti committed Dec 25, 2018
1 parent c84dbd9 commit a23295c
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -473,7 +473,7 @@ private void applyKeptDiffElement(Kept kept, TextElement originalElement, boolea
// just a left brace followed by space

diffIndex++;
if (!doWeHaveLeftBraceFollowedBySpace(originalIndex - 1)) {
if (!wasSpaceBetweenBraces()) {
for (int i = 0; i < STANDARD_INDENTATION_SIZE && originalIndex >= 1 && nodeText.getTextElement(originalIndex - 1).isSpaceOrTab(); i++) {
nodeText.removeElement(--originalIndex);
}
Expand All @@ -483,6 +483,11 @@ private void applyKeptDiffElement(Kept kept, TextElement originalElement, boolea
}
}

private boolean wasSpaceBetweenBraces() {
return nodeText.getTextElement(originalIndex).isToken(RBRACE)
&& doWeHaveLeftBraceFollowedBySpace(originalIndex - 1);
}

private boolean doWeHaveLeftBraceFollowedBySpace(int index) {
index = rewindSpace(index);
return nodeText.getElements().get(index).isToken(LBRACE);
Expand Down

0 comments on commit a23295c

Please sign in to comment.