Add LineSuffix reserved width (#6830)

Thanks for working on this.
This commit is contained in:
Chris Pryer 2023-08-28 01:46:54 -04:00 committed by GitHub
parent 6bc1ba6d62
commit 039694aaed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 111 additions and 28 deletions

View file

@ -459,8 +459,16 @@ impl Format<IrFormatContext<'_>> for &[FormatElement] {
)?;
}
StartLineSuffix => {
write!(f, [text("line_suffix(")])?;
StartLineSuffix { reserved_width } => {
write!(
f,
[
text("line_suffix("),
dynamic_text(&std::format!("{reserved_width:?}"), None),
text(","),
space(),
]
)?;
}
StartVerbatim(_) => {
@ -672,7 +680,9 @@ impl FormatElements for [FormatElement] {
match element {
// Line suffix
// Ignore if any of its content breaks
FormatElement::Tag(Tag::StartLineSuffix | Tag::StartFitsExpanded(_)) => {
FormatElement::Tag(
Tag::StartLineSuffix { reserved_width: _ } | Tag::StartFitsExpanded(_),
) => {
ignore_depth += 1;
}
FormatElement::Tag(Tag::EndLineSuffix | Tag::EndFitsExpanded) => {