diff options
| author | Aram Drevekenin <aram@poor.dev> | 2026-02-24 10:37:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-24 10:37:08 +0100 |
| commit | 2f069143fda47709707245840ba44c6c33fc21ff (patch) | |
| tree | c8ff0c016f33e2ea78aff18efe8b8062ab04980f /zellij-utils/src/ipc | |
| parent | [Windows port PR7] refactor: upgrade sysinfo and add cross-compilation proof ... (diff) | |
| download | sl0ppij-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/ipc')
| -rw-r--r-- | zellij-utils/src/ipc/protobuf_conversion.rs | 18 | ||||
| -rw-r--r-- | zellij-utils/src/ipc/tests/roundtrip_tests.rs | 17 |
2 files changed, 30 insertions, 5 deletions
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), |
