From be0da690917301ccbacd5f0d8e119cc69b583875 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Thu, 27 Feb 2020 18:10:37 -0800 Subject: [PATCH] ui.gadgets.paragraphs: faster pref-dim. Now computing gadget-metrics once, before called (measure-metrics) twice, the first time adding the result, the second time dropping the top of stack. --- basis/ui/gadgets/paragraphs/paragraphs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/ui/gadgets/paragraphs/paragraphs.factor b/basis/ui/gadgets/paragraphs/paragraphs.factor index 3f7ecca322..6ed04ceae1 100644 --- a/basis/ui/gadgets/paragraphs/paragraphs.factor +++ b/basis/ui/gadgets/paragraphs/paragraphs.factor @@ -37,7 +37,7 @@ TUPLE: line words width height baseline ; : ( words -- line ) [ ] [ line-width ] [ [ key>> ] map dup pref-dims ] tri - [ measure-height ] [ measure-metrics drop ] 2bi line boa ; + measure-metrics [ + ] 2keep drop line boa ; : wrap-paragraph ( paragraph -- wrapped-paragraph ) [ children>> [ gadget>word ] map ] [ margin>> ] bi