diff --git a/source/com/intellij/codeFormatting/general/FormatterUtil.java b/source/com/intellij/codeFormatting/general/FormatterUtil.java index 69a3902ba35d..fdbcba917145 100644 --- a/source/com/intellij/codeFormatting/general/FormatterUtil.java +++ b/source/com/intellij/codeFormatting/general/FormatterUtil.java @@ -45,7 +45,7 @@ public class FormatterUtil { while (wsCandidate != null && isSpaceTextElement(wsCandidate)) { result.append(wsCandidate.getText()); final TreeElement newValue = getWsCandidate(wsCandidate); - if (wsCandidate == newValue) break; + if (wsCandidate.getStartOffset() == newValue.getStartOffset()) break; wsCandidate = newValue; } return result.toString();