From 148b797de2278ab07e3440915fc5ac2ec19975bf Mon Sep 17 00:00:00 2001 From: Yaroslav Lepenkin Date: Thu, 2 Jul 2015 14:17:28 +0300 Subject: [PATCH] Reformat with context: do not touch blocks with read only spacing property. Spacing is set to read-only by FormattingModelBuilder implementors, so they expect spacing to be really read-only, however if WhiteSpace is read-only but Spacing is not, it means that we are formatting text range, and current WhiteSpace is not located inside, so we can modify in such a case --- .../lang-impl/src/com/intellij/formatting/FormatProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java b/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java index b2d1d2519e5d..5b6d1d00e539 100644 --- a/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java +++ b/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java @@ -475,7 +475,7 @@ public class FormatProcessor { final WhiteSpace whiteSpace = myCurrentBlock.getWhiteSpace(); if (isReformatSelectedRangesContext()) { - if (isCurrentBlockAlignmentUsedInRangesToModify() && whiteSpace.isReadOnly()) { + if (isCurrentBlockAlignmentUsedInRangesToModify() && whiteSpace.isReadOnly() && !spaceProperty.isReadOnly()) { whiteSpace.setReadOnly(false); whiteSpace.setLineFeedsAreReadOnly(true); }