Index: pkg/analysis_server/lib/src/services/correction/assist_internal.dart |
diff --git a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart |
index adfcbd6755a6725bc8b05c337f823bcfe22a3445..e706a77135a47d10bbbf5f7ec0681645ab682d16 100644 |
--- a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart |
+++ b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart |
@@ -1772,10 +1772,12 @@ class AssistProcessor { |
sb.append('('); |
if (newExprSrc.contains(eol)) { |
int newlineIdx = newExprSrc.lastIndexOf(eol); |
- if (newlineIdx == newExprSrc.length - 1) { |
- newlineIdx -= 1; |
+ int eolLen = eol.length; |
+ if (newlineIdx == newExprSrc.length - eolLen) { |
+ newlineIdx -= eolLen; |
} |
- String indentOld = utils.getLinePrefix(newExpr.offset + 1 + newlineIdx); |
+ String indentOld = |
+ utils.getLinePrefix(newExpr.offset + eolLen + newlineIdx); |
String indentNew = '$indentOld${utils.getIndent(1)}'; |
sb.append(eol); |
sb.append(indentNew); |