fix for format behavior for multi-line strings

This commit is contained in:
Nathan Freestone 2022-12-11 14:53:22 -07:00
parent 116463893a
commit 83f4cdfaeb
No known key found for this signature in database
GPG key ID: CF9A4C2F15E3F0A1

View file

@ -556,8 +556,13 @@ pub fn fmt_str_literal<'buf>(buf: &mut Buf<'buf>, literal: StrLiteral, indent: u
for segments in lines.iter() {
for seg in segments.iter() {
buf.indent(indent);
format_str_segment(seg, buf, indent);
// only add indent if the line isn't empty
if *seg != StrSegment::Plaintext("\n") {
buf.indent(indent);
format_str_segment(seg, buf, indent);
} else {
buf.newline();
}
}
buf.newline();