# gpui: Add grid repeat min content API \(\#44973\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/f358b9531a3311b449c3fde41a04f7bfc0c574f2)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: f358b9531a3311b449c3fde41a04f7bfc0c574f2

Requested commit: f358b9531a3311b449c3fde41a04f7bfc0c574f2

Commit: f358b9531a3311b449c3fde41a04f7bfc0c574f2

Tree: d12973000b8f4e08b2088b682d59609187a30652

Author: Smit Barmase

Committer: GitHub

## Message

```
gpui: Add grid repeat min content API (#44973)

Required for https://github.com/zed-industries/zed/pull/44712

We started using `grid` for Markdown tables instead of flex. This
resulted in tables having a width of 0 inside popovers, since popovers
are laid out using `AvailableSpace::MinContent`.

One way to fix this is to lay out popovers using `MaxContent` instead.
But that would affect all Markdown rendered in popovers and could change
how popovers look, or regress things.

The other option is to fix it where the problem actually is:
`repeat(count, vec![minmax(length(0.0), fr(1.0))])`. Since the minimum
width here is `0`, laying things out with `MinContent` causes the
Markdown table to shrink completely. What we want instead is for the
minimum width to be the min-content size, but only for Markdown rendered
inside popovers.

This PR does exactly that, without interfering with the `grid_cols` API,
which intentionally follows a TailwindCSS-like convention. See
https://github.com/zed-industries/zed/pull/44368 for context.

Release Notes:

- N/A
```

## Parents

- [ba24ac7aae456dc3862fcd569a5041388d05f96c](https://git.cafe/gitcafe/zed/commit/ba24ac7aae456dc3862fcd569a5041388d05f96c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/f358b9531a3311b449c3fde41a04f7bfc0c574f2?format=markdown)
