aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-server/src/plugins
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-07-18 10:45:42 +0200
committerGitHub <noreply@github.com>2024-07-18 10:45:42 +0200
commit2deffc3289ff05a1429366cfa7cf7195ec27034f (patch)
tree5e8af968db1c5bb966bfe25b484c001378ab9351 /zellij-server/src/plugins
parentdocs(changelog): configuration screen (diff)
downloadsl0ppij-2deffc3289ff05a1429366cfa7cf7195ec27034f.tar.gz
sl0ppij-2deffc3289ff05a1429366cfa7cf7195ec27034f.tar.xz
sl0ppij-2deffc3289ff05a1429366cfa7cf7195ec27034f.zip
feat(plugins): add stringified layout to switch_session_with_layout (#3503)
Diffstat (limited to 'zellij-server/src/plugins')
-rw-r--r--zellij-server/src/plugins/zellij_exports.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs
index 21b8b01d..0006e048 100644
--- a/zellij-server/src/plugins/zellij_exports.rs
+++ b/zellij-server/src/plugins/zellij_exports.rs
@@ -922,6 +922,13 @@ fn switch_session(
) -> Result<()> {
// pane_id is (id, is_plugin)
let err_context = || format!("Failed to switch session");
+ if let Some(LayoutInfo::Stringified(stringified_layout)) = layout.as_ref() {
+ // we verify the stringified layout here to fail early rather than when parsing it at the
+ // session-switching phase
+ if let Err(e) = Layout::from_kdl(&stringified_layout, None, None, None) {
+ return Err(anyhow!("Failed to deserialize layout: {}", e));
+ }
+ }
let client_id = env.client_id;
let tab_position = tab_position.map(|p| p + 1); // ¯\_()_/¯
let connect_to_session = ConnectToSession {