From 4e49cc5a37c4aa0e900d659b2f69619b0a89da27 Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Wed, 15 Jul 2015 14:35:21 +0300 Subject: [PATCH] Use TextRange#shiftRight instead of utility method shiftRange in FormatProcessor --- .../src/com/intellij/formatting/FormatProcessor.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java b/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java index b4e7c5be552e..908e098a2c3b 100644 --- a/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java +++ b/platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java @@ -411,7 +411,7 @@ public class FormatProcessor { ) { final WhiteSpace whiteSpace = block.getWhiteSpace(); final TextRange textRange = whiteSpace.getTextRange(); - final TextRange wsRange = shiftRange(textRange, shift); + final TextRange wsRange = textRange.shiftRight(shift); final String newWhiteSpace = _newWhiteSpace.toString(); TextRange newWhiteSpaceRange = model instanceof FormattingModelEx ? ((FormattingModelEx) model).replaceWhiteSpace(wsRange, block.getNode(), newWhiteSpace) @@ -420,7 +420,7 @@ public class FormatProcessor { shift += newWhiteSpaceRange.getLength() - textRange.getLength(); if (block.isLeaf() && whiteSpace.containsLineFeeds() && block.containsLineFeeds()) { - final TextRange currentBlockRange = shiftRange(block.getTextRange(), shift); + final TextRange currentBlockRange = block.getTextRange().shiftRight(shift); IndentInside oldBlockIndent = whiteSpace.getInitialLastLineIndent(); IndentInside whiteSpaceIndent = IndentInside.createIndentOn(IndentInside.getLastLine(newWhiteSpace)); @@ -466,10 +466,6 @@ public class FormatProcessor { return result == null ? fallbackIndentOptions : result; } - private static TextRange shiftRange(final TextRange textRange, final int shift) { - return new TextRange(textRange.getStartOffset() + shift, textRange.getEndOffset() + shift); - } - private void processToken() { final SpacingImpl spaceProperty = myCurrentBlock.getSpaceProperty(); final WhiteSpace whiteSpace = myCurrentBlock.getWhiteSpace();