mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
## Description
When a win is relative = "win" it should size itself relative to that
win's size. Currently this only happens correctly when the picker layout
is created. All subsequent updates, such as a toggle_preview action, can
potentially trigger calls to a function width/height opt with a
max_width and max_height smaller than was previously calculated. This
feeds into a recursive series of updates triggered by the WinResized
event triggering and updating with a yet smaller max_width or
max_height.
Additionally, because win.o.cols and win.o.lines is used,
relative/decimal dimensions would not calculate correctly in splits.
Screenshots are from a picker configured as
```
{
col = 1,
height = 0.9,
width = 0.9,
position = 'float',
relative = 'win',
}
```
**before**
<img width="1348" height="1358" alt="image"
src="https://github.com/user-attachments/assets/847b0565-afd0-4ca1-b44c-eb63e335afca"
/>
**after**
<img width="1354" height="1354" alt="image"
src="https://github.com/user-attachments/assets/064f25ae-ed17-42c8-8b34-f32652fab02d"
/>
|
||
|---|---|---|
| .. | ||
| snacks | ||
| trouble/sources | ||