diff options
| author | Aram Drevekenin <aram@poor.dev> | 2024-07-18 10:45:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-18 10:45:42 +0200 |
| commit | 2deffc3289ff05a1429366cfa7cf7195ec27034f (patch) | |
| tree | 5e8af968db1c5bb966bfe25b484c001378ab9351 /zellij-server/src/plugins | |
| parent | docs(changelog): configuration screen (diff) | |
| download | sl0ppij-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.rs | 7 |
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 { |
