aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils
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
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')
-rw-r--r--zellij-utils/assets/prost_ipc/client_server_contract.rs10
-rw-r--r--zellij-utils/src/cli.rs68
-rw-r--r--zellij-utils/src/client_server_contract/common_types.proto6
-rw-r--r--zellij-utils/src/input/actions.rs20
-rw-r--r--zellij-utils/src/ipc/protobuf_conversion.rs18
-rw-r--r--zellij-utils/src/ipc/tests/roundtrip_tests.rs17
-rw-r--r--zellij-utils/src/kdl/mod.rs32
-rw-r--r--zellij-utils/src/plugin_api/action.rs17
-rw-r--r--zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap7
-rw-r--r--zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap7
-rw-r--r--zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap7
-rw-r--r--zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap7
12 files changed, 198 insertions, 18 deletions
diff --git a/zellij-utils/assets/prost_ipc/client_server_contract.rs b/zellij-utils/assets/prost_ipc/client_server_contract.rs
index a6ed7a1d..5d58692f 100644
--- a/zellij-utils/assets/prost_ipc/client_server_contract.rs
+++ b/zellij-utils/assets/prost_ipc/client_server_contract.rs
@@ -708,6 +708,8 @@ pub struct EditFileAction {
pub coordinates: ::core::option::Option<FloatingPaneCoordinates>,
#[prost(bool, tag="7")]
pub near_current_pane: bool,
+ #[prost(bool, tag="8")]
+ pub close_replaced_pane: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
@@ -747,7 +749,7 @@ pub struct NewInPlacePaneAction {
#[prost(message, optional, tag="4")]
pub pane_id_to_replace: ::core::option::Option<PaneId>,
#[prost(bool, tag="5")]
- pub close_replace_pane: bool,
+ pub close_replaced_pane: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
@@ -848,6 +850,8 @@ pub struct LaunchOrFocusPluginAction {
pub should_open_in_place: bool,
#[prost(bool, tag="5")]
pub skip_cache: bool,
+ #[prost(bool, tag="6")]
+ pub close_replaced_pane: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
@@ -862,6 +866,8 @@ pub struct LaunchPluginAction {
pub skip_cache: bool,
#[prost(string, optional, tag="5")]
pub cwd: ::core::option::Option<::prost::alloc::string::String>,
+ #[prost(bool, tag="6")]
+ pub close_replaced_pane: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
@@ -928,6 +934,8 @@ pub struct NewInPlacePluginPaneAction {
pub pane_name: ::core::option::Option<::prost::alloc::string::String>,
#[prost(bool, tag="3")]
pub skip_cache: bool,
+ #[prost(bool, tag="4")]
+ pub close_replaced_pane: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
diff --git a/zellij-utils/src/cli.rs b/zellij-utils/src/cli.rs
index cb13299d..afe198b8 100644
--- a/zellij-utils/src/cli.rs
+++ b/zellij-utils/src/cli.rs
@@ -364,6 +364,16 @@ pub enum Sessions {
)]
in_place: bool,
+ /// Close the replaced pane instead of suspending it (only effective with --in-place)
+ #[clap(
+ long,
+ value_parser,
+ default_value("false"),
+ takes_value(false),
+ requires("in-place")
+ )]
+ close_replaced_pane: bool,
+
/// Name of the new pane
#[clap(short, long, value_parser)]
name: Option<String>,
@@ -475,6 +485,16 @@ pub enum Sessions {
)]
in_place: bool,
+ /// Close the replaced pane instead of suspending it (only effective with --in-place)
+ #[clap(
+ long,
+ value_parser,
+ default_value("false"),
+ takes_value(false),
+ requires("in-place")
+ )]
+ close_replaced_pane: bool,
+
/// Skip the memory and HD cache and force recompile of the plugin (good for development)
#[clap(short, long, value_parser, default_value("false"), takes_value(false))]
skip_plugin_cache: bool,
@@ -524,6 +544,16 @@ pub enum Sessions {
)]
in_place: bool,
+ /// Close the replaced pane instead of suspending it (only effective with --in-place)
+ #[clap(
+ long,
+ value_parser,
+ default_value("false"),
+ takes_value(false),
+ requires("in-place")
+ )]
+ close_replaced_pane: bool,
+
/// Open the new pane in floating mode
#[clap(short, long, value_parser, default_value("false"), takes_value(false))]
floating: bool,
@@ -753,6 +783,16 @@ pub enum CliAction {
)]
in_place: bool,
+ /// Close the replaced pane instead of suspending it (only effective with --in-place)
+ #[clap(
+ long,
+ value_parser,
+ default_value("false"),
+ takes_value(false),
+ requires("in-place")
+ )]
+ close_replaced_pane: bool,
+
/// Name of the new pane
#[clap(short, long, value_parser)]
name: Option<String>,
@@ -849,6 +889,16 @@ pub enum CliAction {
)]
in_place: bool,
+ /// Close the replaced pane instead of suspending it (only effective with --in-place)
+ #[clap(
+ long,
+ value_parser,
+ default_value("false"),
+ takes_value(false),
+ requires("in-place")
+ )]
+ close_replaced_pane: bool,
+
/// Change the working directory of the editor
#[clap(long, value_parser)]
cwd: Option<PathBuf>,
@@ -1061,6 +1111,15 @@ pub enum CliAction {
floating: bool,
#[clap(short, long, value_parser)]
in_place: bool,
+ /// Close the replaced pane instead of suspending it (only effective with --in-place)
+ #[clap(
+ long,
+ value_parser,
+ default_value("false"),
+ takes_value(false),
+ requires("in-place")
+ )]
+ close_replaced_pane: bool,
#[clap(short, long, value_parser)]
move_to_focused_tab: bool,
url: String,
@@ -1075,6 +1134,15 @@ pub enum CliAction {
floating: bool,
#[clap(short, long, value_parser)]
in_place: bool,
+ /// Close the replaced pane instead of suspending it (only effective with --in-place)
+ #[clap(
+ long,
+ value_parser,
+ default_value("false"),
+ takes_value(false),
+ requires("in-place")
+ )]
+ close_replaced_pane: bool,
url: Url,
#[clap(short, long, value_parser)]
configuration: Option<PluginUserConfiguration>,
diff --git a/zellij-utils/src/client_server_contract/common_types.proto b/zellij-utils/src/client_server_contract/common_types.proto
index 59305d7a..3a9e854b 100644
--- a/zellij-utils/src/client_server_contract/common_types.proto
+++ b/zellij-utils/src/client_server_contract/common_types.proto
@@ -401,6 +401,7 @@ message EditFileAction {
bool start_suppressed = 5;
optional FloatingPaneCoordinates coordinates = 6;
bool near_current_pane = 7;
+ bool close_replaced_pane = 8;
}
message NewFloatingPaneAction {
@@ -423,7 +424,7 @@ message NewInPlacePaneAction {
optional string pane_name = 2;
bool near_current_pane = 3;
optional PaneId pane_id_to_replace = 4;
- bool close_replace_pane = 5;
+ bool close_replaced_pane = 5;
}
message NewStackedPaneAction {
@@ -484,6 +485,7 @@ message LaunchOrFocusPluginAction {
bool move_to_focused_tab = 3;
bool should_open_in_place = 4;
bool skip_cache = 5;
+ bool close_replaced_pane = 6;
}
message LaunchPluginAction {
@@ -492,6 +494,7 @@ message LaunchPluginAction {
bool should_open_in_place = 3;
bool skip_cache = 4;
optional string cwd = 5;
+ bool close_replaced_pane = 6;
}
message MouseEventAction {
@@ -533,6 +536,7 @@ message NewInPlacePluginPaneAction {
RunPluginOrAlias plugin = 1;
optional string pane_name = 2;
bool skip_cache = 3;
+ bool close_replaced_pane = 4;
}
message StartOrReloadPluginAction {
diff --git a/zellij-utils/src/input/actions.rs b/zellij-utils/src/input/actions.rs
index cb49c433..025b0535 100644
--- a/zellij-utils/src/input/actions.rs
+++ b/zellij-utils/src/input/actions.rs
@@ -232,6 +232,7 @@ pub enum Action {
direction: Option<Direction>,
floating: bool,
in_place: bool,
+ close_replaced_pane: bool,
start_suppressed: bool,
coordinates: Option<FloatingPaneCoordinates>,
near_current_pane: bool,
@@ -260,7 +261,7 @@ pub enum Action {
pane_name: Option<String>,
near_current_pane: bool,
pane_id_to_replace: Option<PaneId>,
- close_replace_pane: bool,
+ close_replaced_pane: bool,
},
/// Returns: Created pane ID (format: terminal_<id> or plugin_<id>)
NewStackedPane {
@@ -334,6 +335,7 @@ pub enum Action {
should_float: bool,
move_to_focused_tab: bool,
should_open_in_place: bool,
+ close_replaced_pane: bool,
skip_cache: bool,
},
/// Returns: Plugin pane ID (format: plugin_<id>)
@@ -341,6 +343,7 @@ pub enum Action {
plugin: RunPluginOrAlias,
should_float: bool,
should_open_in_place: bool,
+ close_replaced_pane: bool,
skip_cache: bool,
cwd: Option<PathBuf>,
},
@@ -401,6 +404,7 @@ pub enum Action {
plugin: RunPluginOrAlias,
pane_name: Option<String>,
skip_cache: bool,
+ close_replaced_pane: bool,
},
StartOrReloadPlugin {
plugin: RunPluginOrAlias,
@@ -682,6 +686,7 @@ impl Action {
cwd,
floating,
in_place,
+ close_replaced_pane,
name,
close_on_exit,
start_suspended,
@@ -736,7 +741,7 @@ impl Action {
} else if in_place {
NewPanePlacement::InPlace {
pane_id_to_replace: None,
- close_replaced_pane: false,
+ close_replaced_pane,
borderless,
}
} else if stacked {
@@ -794,6 +799,7 @@ impl Action {
plugin,
pane_name: name,
skip_cache: skip_plugin_cache,
+ close_replaced_pane,
}])
} else {
// it is intentional that a new tiled plugin pane cannot include a
@@ -840,7 +846,7 @@ impl Action {
pane_name: name,
near_current_pane,
pane_id_to_replace: None, // TODO: support this
- close_replace_pane: false,
+ close_replaced_pane,
}])
} else if stacked {
Ok(vec![Action::NewStackedPane {
@@ -873,7 +879,7 @@ impl Action {
pane_name: name,
near_current_pane,
pane_id_to_replace: None, // TODO: support this
- close_replace_pane: false,
+ close_replaced_pane,
}])
} else if stacked {
Ok(vec![Action::NewStackedPane {
@@ -898,6 +904,7 @@ impl Action {
line_number,
floating,
in_place,
+ close_replaced_pane,
cwd,
x,
y,
@@ -923,6 +930,7 @@ impl Action {
direction,
floating,
in_place,
+ close_replaced_pane,
start_suppressed,
coordinates: FloatingPaneCoordinates::new(
x, y, width, height, pinned, borderless,
@@ -1263,6 +1271,7 @@ impl Action {
url,
floating,
in_place,
+ close_replaced_pane,
move_to_focused_tab,
configuration,
skip_plugin_cache,
@@ -1279,6 +1288,7 @@ impl Action {
should_float: floating,
move_to_focused_tab,
should_open_in_place: in_place,
+ close_replaced_pane,
skip_cache: skip_plugin_cache,
}])
},
@@ -1286,6 +1296,7 @@ impl Action {
url,
floating,
in_place,
+ close_replaced_pane,
configuration,
skip_plugin_cache,
} => {
@@ -1300,6 +1311,7 @@ impl Action {
plugin: run_plugin_or_alias,
should_float: floating,
should_open_in_place: in_place,
+ close_replaced_pane,
skip_cache: skip_plugin_cache,
cwd: Some(current_dir),
}])
diff --git a/zellij-utils/src/ipc/protobuf_conversion.rs b/zellij-utils/src/ipc/protobuf_conversion.rs
index 894bdac8..8d8bd542 100644
--- a/zellij-utils/src/ipc/protobuf_conversion.rs
+++ b/zellij-utils/src/ipc/protobuf_conversion.rs
@@ -892,6 +892,7 @@ impl From<crate::input::actions::Action>
direction,
floating,
in_place,
+ close_replaced_pane,
start_suppressed,
coordinates,
near_current_pane,
@@ -900,6 +901,7 @@ impl From<crate::input::actions::Action>
direction: direction.map(|d| direction_to_proto_i32(d)),
floating,
in_place,
+ close_replaced_pane,
start_suppressed,
coordinates: coordinates.map(|c| c.into()),
near_current_pane,
@@ -933,13 +935,13 @@ impl From<crate::input::actions::Action>
pane_name,
near_current_pane,
pane_id_to_replace,
- close_replace_pane,
+ close_replaced_pane,
} => ActionType::NewInPlacePane(NewInPlacePaneAction {
command: command.map(|c| c.into()),
pane_name,
near_current_pane,
pane_id_to_replace: pane_id_to_replace.and_then(|p| p.try_into().ok()),
- close_replace_pane,
+ close_replaced_pane,
}),
crate::input::actions::Action::NewStackedPane {
command,
@@ -1065,24 +1067,28 @@ impl From<crate::input::actions::Action>
should_float,
move_to_focused_tab,
should_open_in_place,
+ close_replaced_pane,
skip_cache,
} => ActionType::LaunchOrFocusPlugin(LaunchOrFocusPluginAction {
plugin: Some(plugin.into()),
should_float,
move_to_focused_tab,
should_open_in_place,
+ close_replaced_pane,
skip_cache,
}),
crate::input::actions::Action::LaunchPlugin {
plugin,
should_float,
should_open_in_place,
+ close_replaced_pane,
skip_cache,
cwd,
} => ActionType::LaunchPlugin(LaunchPluginAction {
plugin: Some(plugin.into()),
should_float,
should_open_in_place,
+ close_replaced_pane,
skip_cache,
cwd: cwd.map(|p| p.to_string_lossy().to_string()),
}),
@@ -1165,10 +1171,12 @@ impl From<crate::input::actions::Action>
plugin,
pane_name,
skip_cache,
+ close_replaced_pane,
} => ActionType::NewInPlacePluginPane(NewInPlacePluginPaneAction {
plugin: Some(plugin.into()),
pane_name,
skip_cache,
+ close_replaced_pane,
}),
crate::input::actions::Action::StartOrReloadPlugin { plugin } => {
ActionType::StartOrReloadPlugin(StartOrReloadPluginAction {
@@ -1531,6 +1539,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
.transpose()?,
floating: edit_file_action.floating,
in_place: edit_file_action.in_place,
+ close_replaced_pane: edit_file_action.close_replaced_pane,
start_suppressed: edit_file_action.start_suppressed,
coordinates: edit_file_action
.coordinates
@@ -1575,7 +1584,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
pane_id_to_replace: new_in_place_action
.pane_id_to_replace
.and_then(|p| p.try_into().ok()),
- close_replace_pane: new_in_place_action.close_replace_pane,
+ close_replaced_pane: new_in_place_action.close_replaced_pane,
})
},
ActionType::NewStackedPane(new_stacked_action) => {
@@ -1730,6 +1739,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
should_float: launch_plugin_action.should_float,
move_to_focused_tab: launch_plugin_action.move_to_focused_tab,
should_open_in_place: launch_plugin_action.should_open_in_place,
+ close_replaced_pane: launch_plugin_action.close_replaced_pane,
skip_cache: launch_plugin_action.skip_cache,
})
},
@@ -1741,6 +1751,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
.try_into()?,
should_float: launch_plugin_action.should_float,
should_open_in_place: launch_plugin_action.should_open_in_place,
+ close_replaced_pane: launch_plugin_action.close_replaced_pane,
skip_cache: launch_plugin_action.skip_cache,
cwd: launch_plugin_action.cwd.map(PathBuf::from),
})
@@ -1839,6 +1850,7 @@ impl TryFrom<crate::client_server_contract::client_server_contract::Action>
.try_into()?,
pane_name: new_in_place_plugin_action.pane_name,
skip_cache: new_in_place_plugin_action.skip_cache,
+ close_replaced_pane: new_in_place_plugin_action.close_replaced_pane,
})
},
ActionType::StartOrReloadPlugin(start_plugin_action) => {
diff --git a/zellij-utils/src/ipc/tests/roundtrip_tests.rs b/zellij-utils/src/ipc/tests/roundtrip_tests.rs
index bd46512e..8cd0cc84 100644
--- a/zellij-utils/src/ipc/tests/roundtrip_tests.rs
+++ b/zellij-utils/src/ipc/tests/roundtrip_tests.rs
@@ -1021,6 +1021,7 @@ fn test_client_messages() {
direction: None,
floating: false,
in_place: false,
+ close_replaced_pane: false,
start_suppressed: false,
coordinates: None,
near_current_pane: false,
@@ -1044,6 +1045,7 @@ fn test_client_messages() {
direction: None,
floating: false,
in_place: false,
+ close_replaced_pane: false,
start_suppressed: false,
coordinates: None,
near_current_pane: false,
@@ -1067,6 +1069,7 @@ fn test_client_messages() {
direction: None,
floating: false,
in_place: false,
+ close_replaced_pane: false,
start_suppressed: false,
coordinates: None,
near_current_pane: false,
@@ -1090,6 +1093,7 @@ fn test_client_messages() {
direction: Some(Direction::Right),
floating: true,
in_place: true,
+ close_replaced_pane: false,
start_suppressed: true,
coordinates: FloatingPaneCoordinates::new(None, None, None, None, None, Some(false)),
near_current_pane: false,
@@ -1113,6 +1117,7 @@ fn test_client_messages() {
direction: Some(Direction::Right),
floating: true,
in_place: true,
+ close_replaced_pane: false,
start_suppressed: true,
coordinates: FloatingPaneCoordinates::new(
Some("100%".to_owned()),
@@ -1143,6 +1148,7 @@ fn test_client_messages() {
direction: Some(Direction::Right),
floating: true,
in_place: true,
+ close_replaced_pane: false,
start_suppressed: true,
coordinates: FloatingPaneCoordinates::new(
Some("10".to_owned()),
@@ -1173,6 +1179,7 @@ fn test_client_messages() {
direction: Some(Direction::Right),
floating: true,
in_place: true,
+ close_replaced_pane: false,
start_suppressed: true,
coordinates: FloatingPaneCoordinates::new(
Some("10".to_owned()),
@@ -1203,6 +1210,7 @@ fn test_client_messages() {
direction: Some(Direction::Right),
floating: true,
in_place: true,
+ close_replaced_pane: false,
start_suppressed: true,
coordinates: FloatingPaneCoordinates::new(
None,
@@ -1343,7 +1351,7 @@ fn test_client_messages() {
pane_name: Some("my_pane_name".to_owned()),
near_current_pane: false,
pane_id_to_replace: None,
- close_replace_pane: false,
+ close_replaced_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -1355,7 +1363,7 @@ fn test_client_messages() {
pane_name: None,
near_current_pane: false,
pane_id_to_replace: None,
- close_replace_pane: false,
+ close_replaced_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
@@ -2189,6 +2197,7 @@ fn test_client_messages() {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: true,
+ close_replaced_pane: false,
skip_cache: true,
},
terminal_id: Some(1),
@@ -2202,6 +2211,7 @@ fn test_client_messages() {
should_float: false,
move_to_focused_tab: false,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
terminal_id: Some(1),
@@ -2214,6 +2224,7 @@ fn test_client_messages() {
plugin: RunPluginOrAlias::RunPlugin(RunPlugin::default()),
should_float: true,
should_open_in_place: true,
+ close_replaced_pane: false,
skip_cache: true,
cwd: None,
},
@@ -2227,6 +2238,7 @@ fn test_client_messages() {
plugin: RunPluginOrAlias::Alias(PluginAlias::default()),
should_float: false,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
cwd: Some(PathBuf::from("/path/to/cwd")),
},
@@ -2436,6 +2448,7 @@ fn test_client_messages() {
plugin: RunPluginOrAlias::Alias(PluginAlias::default()),
pane_name: Some("my_pane_name".to_owned()),
skip_cache: true,
+ close_replaced_pane: false,
},
terminal_id: Some(1),
client_id: Some(100),
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
diff --git a/zellij-utils/src/plugin_api/action.rs b/zellij-utils/src/plugin_api/action.rs
index 0463a40d..1a8ab956 100644
--- a/zellij-utils/src/plugin_api/action.rs
+++ b/zellij-utils/src/plugin_api/action.rs
@@ -323,6 +323,7 @@ impl TryFrom<ProtobufAction> for Action {
direction,
floating: should_float,
in_place: should_be_in_place,
+ close_replaced_pane: false,
start_suppressed: false,
coordinates: None,
near_current_pane,
@@ -615,6 +616,7 @@ impl TryFrom<ProtobufAction> for Action {
should_float,
move_to_focused_tab,
should_open_in_place,
+ close_replaced_pane: false,
skip_cache: skip_plugin_cache,
})
},
@@ -643,6 +645,7 @@ impl TryFrom<ProtobufAction> for Action {
plugin: run_plugin_or_alias,
should_float,
should_open_in_place,
+ close_replaced_pane: false,
skip_cache: skip_plugin_cache,
cwd: None,
})
@@ -971,7 +974,7 @@ impl TryFrom<ProtobufAction> for Action {
let near_current_pane = payload.near_current_pane;
let pane_id_to_replace =
payload.pane_id_to_replace.and_then(|p| p.try_into().ok());
- let close_replace_pane = payload.close_replace_pane;
+ let close_replaced_pane = payload.close_replace_pane;
if let Some(command) = payload.command {
let pane_name = command.pane_name.clone();
let run_command_action: RunCommandAction = command.try_into()?;
@@ -980,7 +983,7 @@ impl TryFrom<ProtobufAction> for Action {
pane_name,
near_current_pane,
pane_id_to_replace,
- close_replace_pane,
+ close_replaced_pane,
})
} else {
Ok(Action::NewInPlacePane {
@@ -988,7 +991,7 @@ impl TryFrom<ProtobufAction> for Action {
pane_name: payload.pane_name,
near_current_pane,
pane_id_to_replace,
- close_replace_pane,
+ close_replaced_pane,
})
}
},
@@ -1220,6 +1223,7 @@ impl TryFrom<Action> for ProtobufAction {
direction,
floating: should_float,
in_place: _should_be_in_place,
+ close_replaced_pane: _close_replaced_pane,
start_suppressed: _start_suppressed,
coordinates: _floating_pane_coordinates,
near_current_pane,
@@ -1457,6 +1461,7 @@ impl TryFrom<Action> for ProtobufAction {
should_float,
move_to_focused_tab,
should_open_in_place,
+ close_replaced_pane: _close_replaced_pane,
skip_cache: skip_plugin_cache,
} => {
let configuration = run_plugin_or_alias.get_configuration().unwrap_or_default();
@@ -1478,6 +1483,7 @@ impl TryFrom<Action> for ProtobufAction {
plugin: run_plugin_or_alias,
should_float,
should_open_in_place,
+ close_replaced_pane: _close_replaced_pane,
skip_cache: skip_plugin_cache,
cwd: _cwd,
} => {
@@ -1745,7 +1751,7 @@ impl TryFrom<Action> for ProtobufAction {
pane_name,
near_current_pane,
pane_id_to_replace,
- close_replace_pane,
+ close_replaced_pane,
} => {
let command = run_command_action.and_then(|r| {
let mut protobuf_run_command_action: ProtobufRunCommandAction =
@@ -1763,7 +1769,7 @@ impl TryFrom<Action> for ProtobufAction {
pane_name: None, // pane_name is already embedded in command
near_current_pane,
pane_id_to_replace,
- close_replace_pane,
+ close_replace_pane: close_replaced_pane,
},
)),
})
@@ -1774,6 +1780,7 @@ impl TryFrom<Action> for ProtobufAction {
plugin: _,
pane_name: _,
skip_cache: _,
+ close_replaced_pane: _,
}
| Action::Deny
| Action::Copy
diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap
index d0f77c3b..4bfd7dc2 100644
--- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap
+++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap
@@ -4186,6 +4186,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4226,6 +4227,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4346,6 +4348,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4436,6 +4439,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4498,6 +4502,7 @@ Config {
),
should_float: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
cwd: None,
},
@@ -4539,6 +4544,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4591,6 +4597,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap
index b2209065..9b47705b 100644
--- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap
+++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap
@@ -4186,6 +4186,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4226,6 +4227,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4346,6 +4348,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4436,6 +4439,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4498,6 +4502,7 @@ Config {
),
should_float: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
cwd: None,
},
@@ -4539,6 +4544,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4591,6 +4597,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap
index 34f7c5ad..a9e97f93 100644
--- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap
+++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap
@@ -4186,6 +4186,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4226,6 +4227,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4346,6 +4348,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4436,6 +4439,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4498,6 +4502,7 @@ Config {
),
should_float: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
cwd: None,
},
@@ -4539,6 +4544,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4591,6 +4597,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap
index fed7c530..f124cb6a 100644
--- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap
+++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap
@@ -4186,6 +4186,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4226,6 +4227,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4346,6 +4348,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4436,6 +4439,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4498,6 +4502,7 @@ Config {
),
should_float: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
cwd: None,
},
@@ -4539,6 +4544,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {
@@ -4591,6 +4597,7 @@ Config {
should_float: true,
move_to_focused_tab: true,
should_open_in_place: false,
+ close_replaced_pane: false,
skip_cache: false,
},
SwitchToMode {