diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/codeStyle/CodeEditUtil.java b/platform/core-impl/src/com/intellij/psi/impl/source/codeStyle/CodeEditUtil.java index ad7a491ee3e3..14ead0d922f0 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/codeStyle/CodeEditUtil.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/codeStyle/CodeEditUtil.java @@ -142,7 +142,7 @@ public class CodeEditUtil { assert child == last : last + " is not a successor of " + first + " in the .getTreeNext() chain"; final ASTNode prevLeaf = TreeUtil.prevLeaf(first); - final ASTNode nextLeaf = TreeUtil.nextLeaf(first); + final ASTNode nextLeaf = TreeUtil.nextLeaf(last); parent.removeRange(first, last.getTreeNext()); ASTNode nextLeafToAdjust = nextLeaf; if (nextLeafToAdjust != null && prevLeaf != null && nextLeafToAdjust.getTreeParent() == null) {