okami.mom/ultraviolet

git clone https://git.nkp.pet/okami.mom/ultraviolet

Ayman Bagabasdocs(layout): add ratatui acknowledgement89c142e

main
710 B29 linesraw
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 (
16	globalCache   = lru.New[cacheKey, cacheValue](globalCacheSize)
17	globalCacheMu sync.Mutex
18)
19
20type cacheKey struct {
21	Area            uv.Rectangle
22	Direction       Direction
23	ConstraintsHash uint64
24	Padding         Padding
25	Spacing         int
26	Flex            Flex
27}
28
29type cacheValue struct{ Segments, Spacers Splitted }