diff --git a/core/src/main/java/com/google/googlejavaformat/java/StringWrapper.java b/core/src/main/java/com/google/googlejavaformat/java/StringWrapper.java index 6814054a2..083947386 100644 --- a/core/src/main/java/com/google/googlejavaformat/java/StringWrapper.java +++ b/core/src/main/java/com/google/googlejavaformat/java/StringWrapper.java @@ -197,12 +197,10 @@ private void indentTextBlocks( ImmutableList initialLines = text.lines().collect(toImmutableList()); String stripped = stripIndent(initialLines.stream().skip(1).collect(joining(separator))); ImmutableList lines = stripped.lines().collect(toImmutableList()); - int deindent = - initialLines.get(1).stripTrailing().length() - lines.get(0).stripTrailing().length(); int startColumn = lineMap.getColumnNumber(startPosition); String prefix = - (deindent == 0 || lines.stream().anyMatch(x -> x.length() + startColumn > columnLimit)) + (lines.stream().anyMatch(x -> x.length() + startColumn > columnLimit)) ? "" : " ".repeat(startColumn - 1); diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/RSLs.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/RSLs.output index 5ca1fb8cc..583b9cc12 100644 --- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/RSLs.output +++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/RSLs.output @@ -48,9 +48,9 @@ ipsum """; String k = """ -lorem -ipsum -"""; + lorem + ipsum + """; { f(