aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/kdl/mod.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-02-24 10:37:08 +0100
committerGitHub <noreply@github.com>2026-02-24 10:37:08 +0100
commit2f069143fda47709707245840ba44c6c33fc21ff (patch)
treec8ff0c016f33e2ea78aff18efe8b8062ab04980f /zellij-utils/src/kdl/mod.rs
parent[Windows port PR7] refactor: upgrade sysinfo and add cross-compilation proof ... (diff)
downloadsl0ppij-2f069143fda47709707245840ba44c6c33fc21ff.tar.gz
sl0ppij-2f069143fda47709707245840ba44c6c33fc21ff.tar.xz
sl0ppij-2f069143fda47709707245840ba44c6c33fc21ff.zip
Allow closing replaced panes when opening panes in place (#4760)
* allow close_replaced_pane from keybind and cli * rustfmt * add pr
Diffstat (limited to 'zellij-utils/src/kdl/mod.rs')
-rw-r--r--zellij-utils/src/kdl/mod.rs32
1 files changed, 30 insertions, 2 deletions
diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs
index 2fd4caa8..03d55417 100644
--- a/zellij-utils/src/kdl/mod.rs
+++ b/zellij-utils/src/kdl/mod.rs
@@ -950,7 +950,7 @@ impl Action {
pane_name: name,
near_current_pane: false,
pane_id_to_replace: None,
- close_replace_pane: false,
+ close_replaced_pane,
} => {
let mut node = KdlNode::new("Run");
let mut node_children = KdlDocument::new();
@@ -978,6 +978,11 @@ impl Action {
node_children.nodes_mut().push(hoc_node);
}
}
+ if *close_replaced_pane {
+ let mut crp_node = KdlNode::new("close_replaced_pane");
+ crp_node.push(KdlValue::Bool(true));
+ node_children.nodes_mut().push(crp_node);
+ }
if let Some(name) = name {
let mut name_node = KdlNode::new("name");
name_node.push(name.clone());
@@ -1069,6 +1074,7 @@ impl Action {
should_float,
move_to_focused_tab,
should_open_in_place,
+ close_replaced_pane,
skip_cache: skip_plugin_cache,
} => {
let mut node = KdlNode::new("LaunchOrFocusPlugin");
@@ -1090,6 +1096,11 @@ impl Action {
should_open_in_place_node.push(KdlValue::Bool(true));
node_children.nodes_mut().push(should_open_in_place_node);
}
+ if *close_replaced_pane {
+ let mut crp_node = KdlNode::new("close_replaced_pane");
+ crp_node.push(KdlValue::Bool(true));
+ node_children.nodes_mut().push(crp_node);
+ }
if *skip_plugin_cache {
let mut skip_plugin_cache_node = KdlNode::new("skip_plugin_cache");
skip_plugin_cache_node.push(KdlValue::Bool(true));
@@ -1111,6 +1122,7 @@ impl Action {
plugin: run_plugin_or_alias,
should_float,
should_open_in_place,
+ close_replaced_pane,
skip_cache: skip_plugin_cache,
cwd,
} => {
@@ -1128,6 +1140,11 @@ impl Action {
should_open_in_place_node.push(KdlValue::Bool(true));
node_children.nodes_mut().push(should_open_in_place_node);
}
+ if *close_replaced_pane {
+ let mut crp_node = KdlNode::new("close_replaced_pane");
+ crp_node.push(KdlValue::Bool(true));
+ node_children.nodes_mut().push(crp_node);
+ }
if *skip_plugin_cache {
let mut skip_plugin_cache_node = KdlNode::new("skip_plugin_cache");
skip_plugin_cache_node.push(KdlValue::Bool(true));
@@ -1892,6 +1909,9 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
let in_place = command_metadata
.and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "in_place"))
.unwrap_or(false);
+ let close_replaced_pane = command_metadata
+ .and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "close_replaced_pane"))
+ .unwrap_or(false);
let stacked = command_metadata
.and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "stacked"))
.unwrap_or(false);
@@ -1935,7 +1955,7 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
pane_name: name,
near_current_pane: false,
pane_id_to_replace: None,
- close_replace_pane: false,
+ close_replaced_pane,
})
} else if stacked {
Ok(Action::NewStackedPane {
@@ -1975,6 +1995,9 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
let should_open_in_place = command_metadata
.and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "in_place"))
.unwrap_or(false);
+ let close_replaced_pane = command_metadata
+ .and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "close_replaced_pane"))
+ .unwrap_or(false);
let skip_plugin_cache = command_metadata
.and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "skip_plugin_cache"))
.unwrap_or(false);
@@ -2001,6 +2024,7 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
should_float,
move_to_focused_tab,
should_open_in_place,
+ close_replaced_pane,
skip_cache: skip_plugin_cache,
})
},
@@ -2023,6 +2047,9 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
let should_open_in_place = command_metadata
.and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "in_place"))
.unwrap_or(false);
+ let close_replaced_pane = command_metadata
+ .and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "close_replaced_pane"))
+ .unwrap_or(false);
let skip_plugin_cache = command_metadata
.and_then(|c_m| kdl_child_bool_value_for_entry(c_m, "skip_plugin_cache"))
.unwrap_or(false);
@@ -2045,6 +2072,7 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
plugin: run_plugin_or_alias,
should_float,
should_open_in_place,
+ close_replaced_pane,
skip_cache: skip_plugin_cache,
cwd: None, // we explicitly do not send the current dir here so that it will be
// filled from the active pane == better UX