fix(wm): address toggle-float container edge case

This commit ensures that the focused container index on a workspace is
updated appropriately if the user calls toggle-float on the last
Container in a Ring. Previously, doing this would leave a ghost tile.
Now that we check if the focused_idx is still valid after removing an
empty Container from the workspace, users will no longer be left with a
ghost tile.
This commit is contained in:
LGUG2Z
2024-04-05 17:12:12 -07:00
parent 5e714cafab
commit 251ec3d53e

View File

@@ -843,6 +843,10 @@ impl Workspace {
if container.windows().is_empty() {
self.containers_mut().remove(focused_idx);
self.resize_dimensions_mut().remove(focused_idx);
if focused_idx == self.containers().len() {
self.focus_container(focused_idx - 1);
}
} else {
container.load_focused_window();
}