From 1d2e303926fbf1b4b39507ae246e8557a4916e7b Mon Sep 17 00:00:00 2001 From: Jae-Heon Ji <32578710+jaeheonji@users.noreply.github.com> Date: Tue, 1 Feb 2022 02:19:21 +0900 Subject: feat: add focus attribute in layout (#958) * feat(layout): add focus attribute in layout * feat: add state of focus to tab * chore: i love clippy * test(layout): update focus options * feat: add focus pane * feat: apply focus-pane when layout is only loaded * change the instruction name for focus-on-tab * chore: apply cargo-fmt * test: add e2e testcase --- zellij-utils/src/input/layout.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'zellij-utils/src/input/layout.rs') diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs index 9fa6709c2..d2125096e 100644 --- a/zellij-utils/src/input/layout.rs +++ b/zellij-utils/src/input/layout.rs @@ -140,6 +140,7 @@ pub struct Layout { pub run: Option, #[serde(default)] pub borderless: bool, + pub focus: Option, } // The struct that is used to deserialize the layout from @@ -421,6 +422,7 @@ pub struct LayoutTemplate { #[serde(default)] pub body: bool, pub split_size: Option, + pub focus: Option, pub run: Option, } @@ -466,6 +468,7 @@ pub struct TabLayout { pub split_size: Option, #[serde(default)] pub name: String, + pub focus: Option, pub run: Option, } @@ -712,6 +715,7 @@ impl TryFrom for Layout { borderless: tab.borderless, parts: Self::from_vec_tab_layout(tab.parts)?, split_size: tab.split_size, + focus: tab.focus, run: tab.run.map(Run::try_from).transpose()?, }) } @@ -726,6 +730,7 @@ impl From for LayoutTemplate { parts: Self::from_vec_tab_layout(tab.parts), body: false, split_size: tab.split_size, + focus: tab.focus, run: tab.run, } } @@ -741,6 +746,7 @@ impl TryFrom for Layout { borderless: template.borderless, parts: Self::from_vec_template_layout(template.parts)?, split_size: template.split_size, + focus: template.focus, run: template .run .map(Run::try_from) @@ -761,6 +767,7 @@ impl Default for TabLayout { run: None, name: String::new(), pane_name: None, + focus: None, } } } @@ -778,10 +785,12 @@ impl Default for LayoutTemplate { body: true, borderless: false, split_size: None, + focus: None, run: None, parts: vec![], }], split_size: None, + focus: None, run: None, } } -- cgit v1.2.3