snacks.nvim/lua
Whitney Beck 602393aed2
fix(layout): provide parent win width/height when relative to win (#2346)
## 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"
/>
2025-10-25 08:22:28 +02:00
..
snacks fix(layout): provide parent win width/height when relative to win (#2346) 2025-10-25 08:22:28 +02:00
trouble/sources Revert "feat: test" 2025-02-14 22:13:38 +01:00