okami.mom/ultraviolet
git clone https://git.nkp.pet/okami.mom/ultraviolet
89c142e
upstream
1package layout 2 3import ( 4"sync" 5 6 uv"github.com/charmbracelet/ultraviolet" 7"github.com/charmbracelet/ultraviolet/internal/lru" 8) 9 10// globalCacheSize is chosen to comfortably hold one entry per row and column 11// of a typical terminal, with headroom to spare. A 171-column x 51-row 12// display yields 222 unique keys; doubling and rounding up gives 500. 13const globalCacheSize = 500 14 15var ( 16globalCache = lru.New [cacheKey ,cacheValue ](globalCacheSize ) 17globalCacheMu sync.Mutex 18) 19 20type cacheKey struct { 21Area uv.Rectangle 22Direction Direction 23ConstraintsHash uint64 24Padding Padding 25Spacing int 26Flex Flex 27} 28 29type cacheValue struct {Segments ,Spacers Splitted }