diff --git a/src/fish_indent.cpp b/src/fish_indent.cpp index 8171bc565..e60f67448 100644 --- a/src/fish_indent.cpp +++ b/src/fish_indent.cpp @@ -400,6 +400,10 @@ struct pretty_printer_t { output.append(L" "); } output.append(L"\\\n"); + // Indent the line continuation (#7252). + current_indent += 1; + emit_space_or_indent(); + current_indent -= 1; } } diff --git a/tests/checks/indent.fish b/tests/checks/indent.fish index ae8ce32d5..a19b818eb 100644 --- a/tests/checks/indent.fish +++ b/tests/checks/indent.fish @@ -248,6 +248,25 @@ end #CHECK: {{ }}# comment #CHECK: end +echo -n ' +cmd \\ +continuation +' | $fish_indent +#CHECK: cmd \ +#CHECK: {{ }}continuation + +echo -n ' +begin +cmd \ +continuation +end +' | $fish_indent +#CHECK: begin +#CHECK: {{ }}cmd \ +#CHECK: {{ }}{{ }}continuation +#CHECK: end + + echo -n ' i\ f true