From d121c780bf3292f7bb2a257b3b23b32ef6c2c6d4 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Thu, 30 Mar 2023 16:53:46 +0200 Subject: [PATCH] fix(layouts): do not default to default swap layouts when opening a new tab without swap layouts (#2336) --- zellij-utils/src/input/actions.rs | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/zellij-utils/src/input/actions.rs b/zellij-utils/src/input/actions.rs index d75897918..d03fd1202 100644 --- a/zellij-utils/src/input/actions.rs +++ b/zellij-utils/src/input/actions.rs @@ -440,16 +440,8 @@ impl Action { if tabs.len() > 1 { return Err(format!("Tab layout cannot itself have tabs")); } else if !tabs.is_empty() { - let swap_tiled_layouts = if layout.swap_tiled_layouts.is_empty() { - None - } else { - Some(layout.swap_tiled_layouts.clone()) - }; - let swap_floating_layouts = if layout.swap_floating_layouts.is_empty() { - None - } else { - Some(layout.swap_floating_layouts.clone()) - }; + let swap_tiled_layouts = Some(layout.swap_tiled_layouts.clone()); + let swap_floating_layouts = Some(layout.swap_floating_layouts.clone()); let (tab_name, layout, floating_panes_layout) = tabs.drain(..).next().unwrap(); let name = tab_name.or(name); @@ -461,16 +453,8 @@ impl Action { name, )]) } else { - let swap_tiled_layouts = if layout.swap_tiled_layouts.is_empty() { - None - } else { - Some(layout.swap_tiled_layouts.clone()) - }; - let swap_floating_layouts = if layout.swap_floating_layouts.is_empty() { - None - } else { - Some(layout.swap_floating_layouts.clone()) - }; + let swap_tiled_layouts = Some(layout.swap_tiled_layouts.clone()); + let swap_floating_layouts = Some(layout.swap_floating_layouts.clone()); let (layout, floating_panes_layout) = layout.new_tab(); Ok(vec![Action::NewTab( Some(layout),