mirror of
https://github.com/typst/typst
synced 2025-08-18 00:48:34 +08:00
Compare commits
No commits in common. "e76ea64cb01eae1950807b06be8c90a6a5d141a0" and "3f10218b4a2c8e3f368282ab03ccf1852349b42b" have entirely different histories.
e76ea64cb0
...
3f10218b4a
@ -18,27 +18,9 @@ impl<'a> GridLayouter<'a> {
|
|||||||
self.upcoming_headers = new_upcoming_headers;
|
self.upcoming_headers = new_upcoming_headers;
|
||||||
|
|
||||||
let (non_conflicting_headers, conflicting_headers) = match conflicting_header {
|
let (non_conflicting_headers, conflicting_headers) = match conflicting_header {
|
||||||
// Headers succeeded by end of grid or footer are short lived and
|
|
||||||
// can be placed in separate regions (no orphan prevention).
|
|
||||||
// TODO: do this during grid resolving?
|
|
||||||
// might be needed for multiple footers. Or maybe not if we check
|
|
||||||
// "upcoming_footers" (O(1) here), however that looks like.
|
|
||||||
_ if consecutive_headers
|
|
||||||
.last()
|
|
||||||
.is_some_and(|x| x.unwrap().end == self.grid.rows.len())
|
|
||||||
|| self
|
|
||||||
.grid
|
|
||||||
.footer
|
|
||||||
.as_ref()
|
|
||||||
.zip(consecutive_headers.last())
|
|
||||||
.is_some_and(|(f, h)| f.unwrap().start == h.unwrap().end) =>
|
|
||||||
{
|
|
||||||
(Default::default(), consecutive_headers)
|
|
||||||
}
|
|
||||||
|
|
||||||
Some(conflicting_header) => {
|
Some(conflicting_header) => {
|
||||||
// All immediately conflicting headers will
|
// All immediately conflicting headers will
|
||||||
// be laid out without orphan prevention.
|
// be placed as normal rows.
|
||||||
consecutive_headers.split_at(consecutive_headers.partition_point(|h| {
|
consecutive_headers.split_at(consecutive_headers.partition_point(|h| {
|
||||||
conflicting_header.unwrap().level > h.unwrap().level
|
conflicting_header.unwrap().level > h.unwrap().level
|
||||||
}))
|
}))
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 254 B |
@ -436,18 +436,3 @@
|
|||||||
[b]
|
[b]
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
--- grid-subheaders-alone-no-orphan-prevention ---
|
|
||||||
#set page(height: 5.3em)
|
|
||||||
#v(2em)
|
|
||||||
#grid(
|
|
||||||
grid.header(
|
|
||||||
// (
|
|
||||||
[L1]
|
|
||||||
),
|
|
||||||
grid.header(
|
|
||||||
// (
|
|
||||||
level: 2,
|
|
||||||
[L2]
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user