From c1b1dbcc0925ba1730fabbfbca3c8b99831c5561 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 11 Mar 2021 10:48:29 +0100 Subject: =?UTF-8?q?Better=20expansion=20behaviour=20=F0=9F=90=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes expansion behaviour inheritable by placing it into the area and passing it down during layouting instead of computing some approximation of what we want during execution. --- src/exec/mod.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/exec/mod.rs') diff --git a/src/exec/mod.rs b/src/exec/mod.rs index ea2c90f4..79ad81e7 100644 --- a/src/exec/mod.rs +++ b/src/exec/mod.rs @@ -11,8 +11,7 @@ use std::rc::Rc; use crate::diag::Pass; use crate::env::Env; use crate::eval::{ExprMap, TemplateFunc, TemplateNode, Value, ValueTemplate}; -use crate::geom::Spec; -use crate::layout::{self, Expansion, NodeSpacing, NodeStack}; +use crate::layout::{self, NodeFixed, NodeSpacing, NodeStack}; use crate::pretty::pretty; use crate::syntax::*; @@ -120,11 +119,17 @@ impl Exec for NodeRaw { ctx.apply_parbreak(); } - ctx.push(NodeStack { - dirs: ctx.state.dirs, - align: ctx.state.align, - expand: Spec::uniform(Expansion::Fit), - children, + // This is wrapped in a fixed node to make sure the stack fits to its + // content instead of filling the available area. + ctx.push(NodeFixed { + width: None, + height: None, + child: NodeStack { + dirs: ctx.state.dirs, + align: ctx.state.align, + children, + } + .into(), }); if self.block { -- cgit v1.2.3