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.
master
John Benediktsson 2020-02-27 18:10:37 -08:00
parent 12079725ac
commit 2379d27950
1 changed files with 1 additions and 1 deletions

View File

@ -37,7 +37,7 @@ TUPLE: line words width height baseline ;
: <line> ( 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