layout: Clamp window height to max available in column
Browse files at this commit20cd4f5d0470d1755f351c53eb2c0f63c27529cfParent: b2c7d3a1 changed file +16 -0
- src/layout/workspace.rs +16 -0
src/layout/workspace.rsmodified+16 -0
| @@ -3484,6 +3484,22 @@ impl<W: LayoutElement> Column<W> { | |||
| 3484 | } | 3484 | } |
| 3485 | }; | 3485 | }; |
| 3486 | 3486 | ||
| 3487 | + // If there are multiple windows in a column, clamp the height according to other windows' | ||
| 3488 | + // min sizes. | ||
| 3489 | + let min_height_taken = self | ||
| 3490 | + .tiles | ||
| 3491 | + .iter() | ||
| 3492 | + .enumerate() | ||
| 3493 | + .filter(|(idx, _)| *idx != tile_idx) | ||
| 3494 | + .map(|(_, tile)| f64::max(1., tile.min_size().h) + self.options.gaps) | ||
| 3495 | + .sum::<f64>(); | ||
| 3496 | + if min_height_taken > 0. { | ||
| 3497 | + let height_left = | ||
| 3498 | + self.working_area.size.h - self.options.gaps - min_height_taken - self.options.gaps; | ||
| 3499 | + let height_left = f64::max(1., tile.window_height_for_tile_height(height_left)); | ||
| 3500 | + window_height = f64::min(height_left, window_height); | ||
| 3501 | + } | ||
| 3502 | + | ||
| 3487 | // Clamp it against the window height constraints. | 3503 | // Clamp it against the window height constraints. |
| 3488 | let win = &self.tiles[tile_idx].window(); | 3504 | let win = &self.tiles[tile_idx].window(); |
| 3489 | let min_h = win.min_size().h; | 3505 | let min_h = win.min_size().h; |