From 251ec3d53e2afef37fb81aff0e5b74c1a5969e48 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 5 Apr 2024 17:12:12 -0700 Subject: [PATCH] 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. --- komorebi/src/workspace.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/komorebi/src/workspace.rs b/komorebi/src/workspace.rs index f1bd005e..8ddae28d 100644 --- a/komorebi/src/workspace.rs +++ b/komorebi/src/workspace.rs @@ -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(); }