Use list spacing for attach spacing in tight lists (#6242)

This commit is contained in:
Tobias Schmitz 2025-05-06 16:03:48 +02:00 committed by GitHub
parent b322da930f
commit 9b09146a6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 23 additions and 11 deletions

View File

@ -259,10 +259,11 @@ impl Show for Packed<EnumElem> {
.spanned(self.span());
if tight {
let leading = ParElem::leading_in(styles);
let spacing =
VElem::new(leading.into()).with_weak(true).with_attach(true).pack();
realized = spacing + realized;
let spacing = self
.spacing(styles)
.unwrap_or_else(|| ParElem::leading_in(styles).into());
let v = VElem::new(spacing.into()).with_weak(true).with_attach(true).pack();
realized = v + realized;
}
Ok(realized)

View File

@ -166,10 +166,11 @@ impl Show for Packed<ListElem> {
.spanned(self.span());
if tight {
let leading = ParElem::leading_in(styles);
let spacing =
VElem::new(leading.into()).with_weak(true).with_attach(true).pack();
realized = spacing + realized;
let spacing = self
.spacing(styles)
.unwrap_or_else(|| ParElem::leading_in(styles).into());
let v = VElem::new(spacing.into()).with_weak(true).with_attach(true).pack();
realized = v + realized;
}
Ok(realized)

View File

@ -189,13 +189,15 @@ impl Show for Packed<TermsElem> {
.styled(TermsElem::set_within(true));
if tight {
let leading = ParElem::leading_in(styles);
let spacing = VElem::new(leading.into())
let spacing = self
.spacing(styles)
.unwrap_or_else(|| ParElem::leading_in(styles).into());
let v = VElem::new(spacing.into())
.with_weak(true)
.with_attach(true)
.pack()
.spanned(span);
realized = spacing + realized;
realized = v + realized;
}
Ok(realized)

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

View File

@ -304,3 +304,11 @@ World
- C
- = D
E
--- issue-6242-tight-list-attach-spacing ---
// Nested tight lists should be uniformly spaced when list spacing is set.
#set list(spacing: 1.2em)
- A
- B
- C
- C