|
90 | 90 |
|
91 | 91 | local function _finalizeCursorAndLayout(win, sector_data, width, height, pad) |
92 | 92 | win.cursorX = sector_data.startX + width + pad |
| 93 | + -- Keep cursorY at the top of this sector for side-by-side placement |
| 94 | + -- The window's own lineHeight tracking will handle vertical wrapping |
93 | 95 | win.cursorY = sector_data.startY |
94 | 96 | win.lineHeight = math.max(win.lineHeight or 0, height) |
95 | 97 |
|
96 | 98 | if #win._sectorStack > 0 then |
97 | 99 | local parentSector = win._sectorStack[#win._sectorStack] |
98 | 100 | parentSector.maxX = math.max(parentSector.maxX, sector_data.startX + width) |
99 | | - parentSector.maxY = math.max(parentSector.maxY, win.cursorY + win.lineHeight) |
| 101 | + -- Use actual bottom of child sector, not reset cursor position |
| 102 | + parentSector.maxY = math.max(parentSector.maxY, sector_data.startY + height) |
100 | 103 | end |
101 | 104 | end |
102 | 105 |
|
@@ -145,8 +148,10 @@ function Sector.Begin(win, label) |
145 | 148 | self.cursorY = self.cursorY + self.lineHeight + baseSpacing + extra |
146 | 149 | -- Keep cursorX constrained to sector's indented start position |
147 | 150 | self.cursorX = sector_data.startX + sector_data.padding |
148 | | - -- track y position after line break relative to window origin |
149 | | - sector_data.maxY = math.max(sector_data.maxY, self.cursorY + self.lineHeight) |
| 151 | + -- Don't update maxY here - let AddWidget expand bounds only when widgets are actually added |
| 152 | + -- This prevents empty space when conditionals hide content after NextLine |
| 153 | + -- Reset lineHeight for the new line (matches Window:NextLine behavior) |
| 154 | + self.lineHeight = 0 |
150 | 155 | end |
151 | 156 |
|
152 | 157 | -- indent cursor for sector padding |
|
0 commit comments