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 22110ad8a..1b2d51a4a 100644 --- a/core/src/main/java/com/google/googlejavaformat/java/StringWrapper.java +++ b/core/src/main/java/com/google/googlejavaformat/java/StringWrapper.java @@ -275,7 +275,7 @@ private static ImmutableList stringComponents( // continue below } else if (hasEscapedWhitespaceAt(text, idx) != -1) { // continue below - } else if (hasEscapedNewlineAt(text, idx) != -1) { + } else if (hasEscapedNewlineAt(text, idx) != -1 || hasEscapedBackslashAt(text, idx) != -1) { int length; while ((length = hasEscapedNewlineAt(text, idx)) != -1) { idx += length; @@ -302,6 +302,13 @@ private static ImmutableList stringComponents( return result.build(); } + static int hasEscapedBackslashAt(String input, int idx) { + if (input.startsWith("\\\\", idx)) { + return 2; + } + return -1; + } + static int hasEscapedWhitespaceAt(String input, int idx) { if (input.startsWith("\\t", idx)) { return 2;