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 | |
| 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
31 files changed, 866 insertions, 35 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b56347a7..7816001d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * fix: do not attempt a reconnect from the web-client when explicitly kicked from the session (https://github.com/zellij-org/zellij/pull/4730) * fix: reset scroll region boundaries when resizing in alternate screen (https://github.com/zellij-org/zellij/pull/4748) * fix: preserve cwd when opening editor panes (https://github.com/zellij-org/zellij/pull/4593) +* feat: allow specifying "close_on_exit" when opening panes in place from keybinding or cli (https://github.com/zellij-org/zellij/pull/4760) ## [0.43.1] - 2025-08-08 diff --git a/default-plugins/status-bar/src/second_line.rs b/default-plugins/status-bar/src/second_line.rs index 00e2b83b..6231db4f 100644 --- a/default-plugins/status-bar/src/second_line.rs +++ b/default-plugins/status-bar/src/second_line.rs @@ -254,7 +254,7 @@ fn get_keys_and_hints(mi: &ModeInfo) -> Vec<(String, String, Vec<KeyWithModifier action_key(&km, &[A::SearchToggleOption{option: SOpt::WholeWord}])), ]} else if mi.mode == IM::Session { vec![ (s("Detach"), s("Detach"), action_key(&km, &[Action::Detach])), - (s("Session Manager"), s("Manager"), action_key(&km, &[A::LaunchOrFocusPlugin{plugin: Default::default(), should_float: true, move_to_focused_tab: true, should_open_in_place: false, skip_cache: false}, TO_NORMAL])), // not entirely accurate + (s("Session Manager"), s("Manager"), action_key(&km, &[A::LaunchOrFocusPlugin{plugin: Default::default(), should_float: true, move_to_focused_tab: true, should_open_in_place: false, close_replaced_pane: false, skip_cache: false}, TO_NORMAL])), // not entirely accurate (s("Select pane"), s("Select"), to_normal_key), ]} else if mi.mode == IM::Tmux { vec![ (s("Move focus"), s("Move"), action_key_group(&km, &[ diff --git a/src/main.rs b/src/main.rs index c5d1fbdb..48fcf67e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,6 +31,7 @@ fn main() { cwd, floating, in_place, + close_replaced_pane, name, close_on_exit, start_suspended, @@ -69,6 +70,7 @@ fn main() { cwd, floating, in_place, + close_replaced_pane, name, close_on_exit, start_suspended, @@ -92,6 +94,7 @@ fn main() { url, floating, in_place, + close_replaced_pane, configuration, skip_plugin_cache, x, @@ -113,6 +116,7 @@ fn main() { cwd, floating, in_place, + close_replaced_pane, name: None, close_on_exit: false, start_suspended: false, @@ -138,6 +142,7 @@ fn main() { line_number, floating, in_place, + close_replaced_pane, cwd, x, y, @@ -161,6 +166,7 @@ fn main() { line_number, floating, in_place, + close_replaced_pane, cwd, x, y, diff --git a/zellij-server/src/pane_groups.rs b/zellij-server/src/pane_groups.rs index 5642bbcd..eb0fcb3d 100644 --- a/zellij-server/src/pane_groups.rs +++ b/zellij-server/src/pane_groups.rs @@ -173,6 +173,7 @@ impl PaneGroups { let _ = self.senders.send_to_pty(PtyInstruction::FillPluginCwd( should_float, should_be_opened_in_place, + false, // close_replaced_pane pane_title, run_plugin, tab_index, diff --git a/zellij-server/src/plugins/mod.rs b/zellij-server/src/plugins/mod.rs index 64942cd7..d26fb7d2 100644 --- a/zellij-server/src/plugins/mod.rs +++ b/zellij-server/src/plugins/mod.rs @@ -60,6 +60,7 @@ pub enum PluginInstruction { Load( Option<bool>, // should float bool, // should be opened in place + bool, // close_replaced_pane Option<String>, // pane title RunPluginOrAlias, Option<usize>, // tab index @@ -346,6 +347,7 @@ pub(crate) fn plugin_thread_main( PluginInstruction::Load( should_float, should_be_open_in_place, + close_replaced_pane, pane_title, mut run_plugin_or_alias, tab_index, @@ -381,6 +383,7 @@ pub(crate) fn plugin_thread_main( drop(bus.senders.send_to_screen(ScreenInstruction::AddPlugin( should_float, should_be_open_in_place, + close_replaced_pane, run_plugin_or_alias, pane_title, tab_index, @@ -460,6 +463,7 @@ pub(crate) fn plugin_thread_main( ScreenInstruction::AddPlugin( should_float, should_be_open_in_place, + false, // close_replaced_pane run_plugin_or_alias, pane_title, Some(tab_index), @@ -1401,6 +1405,7 @@ fn load_background_plugin( drop(bus.senders.send_to_screen(ScreenInstruction::AddPlugin( should_float, should_be_open_in_place, + false, // close_replaced_pane run_plugin_or_alias, pane_title, None, diff --git a/zellij-server/src/plugins/unit/plugin_tests.rs b/zellij-server/src/plugins/unit/plugin_tests.rs index 507220ac..a5f2e420 100644 --- a/zellij-server/src/plugins/unit/plugin_tests.rs +++ b/zellij-server/src/plugins/unit/plugin_tests.rs @@ -741,6 +741,7 @@ pub fn load_new_plugin_from_hd() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -825,6 +826,7 @@ pub fn load_new_plugin_with_plugin_alias() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -905,6 +907,7 @@ pub fn plugin_workers() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -989,6 +992,7 @@ pub fn plugin_workers_persist_state() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -1083,6 +1087,7 @@ pub fn can_subscribe_to_hd_events() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -1165,6 +1170,7 @@ pub fn switch_to_mode_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -1241,6 +1247,7 @@ pub fn switch_to_mode_plugin_command_permission_denied() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -1317,6 +1324,7 @@ pub fn new_tabs_with_layout_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -1407,6 +1415,7 @@ pub fn new_tab_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -1483,6 +1492,7 @@ pub fn go_to_next_tab_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -1558,6 +1568,7 @@ pub fn go_to_previous_tab_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -1633,6 +1644,7 @@ pub fn resize_focused_pane_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -1708,6 +1720,7 @@ pub fn resize_focused_pane_with_direction_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -1783,6 +1796,7 @@ pub fn focus_next_pane_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -1858,6 +1872,7 @@ pub fn focus_previous_pane_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -1933,6 +1948,7 @@ pub fn move_focus_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -2008,6 +2024,7 @@ pub fn move_focus_or_tab_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -2083,6 +2100,7 @@ pub fn edit_scrollback_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -2158,6 +2176,7 @@ pub fn write_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -2233,6 +2252,7 @@ pub fn write_chars_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -2308,6 +2328,7 @@ pub fn toggle_tab_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -2383,6 +2404,7 @@ pub fn move_pane_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -2458,6 +2480,7 @@ pub fn move_pane_with_direction_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -2534,6 +2557,7 @@ pub fn clear_screen_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -2610,6 +2634,7 @@ pub fn scroll_up_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -2685,6 +2710,7 @@ pub fn scroll_down_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -2760,6 +2786,7 @@ pub fn scroll_to_top_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -2835,6 +2862,7 @@ pub fn scroll_to_bottom_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -2910,6 +2938,7 @@ pub fn page_scroll_up_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -2985,6 +3014,7 @@ pub fn page_scroll_down_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -3060,6 +3090,7 @@ pub fn toggle_focus_fullscreen_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -3135,6 +3166,7 @@ pub fn toggle_pane_frames_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -3210,6 +3242,7 @@ pub fn toggle_pane_embed_or_eject_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -3285,6 +3318,7 @@ pub fn undo_rename_pane_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -3360,6 +3394,7 @@ pub fn close_focus_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -3435,6 +3470,7 @@ pub fn toggle_active_tab_sync_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -3510,6 +3546,7 @@ pub fn close_focused_tab_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -3585,6 +3622,7 @@ pub fn undo_rename_tab_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -3660,6 +3698,7 @@ pub fn previous_swap_layout_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -3735,6 +3774,7 @@ pub fn next_swap_layout_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -3810,6 +3850,7 @@ pub fn go_to_tab_name_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -3885,6 +3926,7 @@ pub fn focus_or_create_tab_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -3960,6 +4002,7 @@ pub fn go_to_tab() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -4035,6 +4078,7 @@ pub fn start_or_reload_plugin() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -4117,6 +4161,7 @@ pub fn quit_zellij_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -4199,6 +4244,7 @@ pub fn detach_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -4281,6 +4327,7 @@ pub fn open_file_floating_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -4367,6 +4414,7 @@ pub fn open_file_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -4454,6 +4502,7 @@ pub fn open_file_with_line_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -4540,6 +4589,7 @@ pub fn open_file_with_line_floating_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -4626,6 +4676,7 @@ pub fn open_terminal_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -4708,6 +4759,7 @@ pub fn open_terminal_floating_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -4790,6 +4842,7 @@ pub fn open_command_pane_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -4872,6 +4925,7 @@ pub fn open_command_pane_floating_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -4947,6 +5001,7 @@ pub fn switch_to_tab_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -5022,6 +5077,7 @@ pub fn hide_self_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -5096,6 +5152,7 @@ pub fn show_self_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -5171,6 +5228,7 @@ pub fn close_terminal_pane_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -5246,6 +5304,7 @@ pub fn close_plugin_pane_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -5321,6 +5380,7 @@ pub fn focus_terminal_pane_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -5396,6 +5456,7 @@ pub fn focus_plugin_pane_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -5471,6 +5532,7 @@ pub fn rename_terminal_pane_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -5546,6 +5608,7 @@ pub fn rename_plugin_pane_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -5621,6 +5684,7 @@ pub fn rename_tab_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -5705,6 +5769,7 @@ pub fn send_configuration_to_plugins() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -5777,6 +5842,7 @@ pub fn request_plugin_permissions() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -5873,6 +5939,7 @@ pub fn granted_permission_request_result() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin.clone(), Some(tab_index), @@ -5968,6 +6035,7 @@ pub fn denied_permission_request_result() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin.clone(), Some(tab_index), @@ -6043,6 +6111,7 @@ pub fn run_command_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -6125,6 +6194,7 @@ pub fn run_command_with_env_vars_and_cwd_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -6207,6 +6277,7 @@ pub fn web_request_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -6282,6 +6353,7 @@ pub fn unblock_input_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -6368,6 +6440,7 @@ pub fn block_input_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -6462,6 +6535,7 @@ pub fn pipe_output_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -6549,6 +6623,7 @@ pub fn pipe_message_to_plugin_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -6647,6 +6722,7 @@ pub fn switch_session_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -6735,6 +6811,7 @@ pub fn switch_session_with_layout_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -6823,6 +6900,7 @@ pub fn switch_session_with_layout_and_cwd_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -6908,6 +6986,7 @@ pub fn disconnect_other_clients_plugins_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -6993,6 +7072,7 @@ pub fn reconfigure_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -7082,6 +7162,7 @@ pub fn run_plugin_in_specific_cwd() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -7160,6 +7241,7 @@ pub fn hide_pane_with_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -7235,6 +7317,7 @@ pub fn show_pane_with_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -7317,6 +7400,7 @@ pub fn open_command_pane_background_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -7396,6 +7480,7 @@ pub fn rerun_command_pane_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -7471,6 +7556,7 @@ pub fn resize_pane_with_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -7546,6 +7632,7 @@ pub fn edit_scrollback_for_pane_with_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -7621,6 +7708,7 @@ pub fn write_to_pane_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -7696,6 +7784,7 @@ pub fn write_chars_to_pane_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -7771,6 +7860,7 @@ pub fn move_pane_with_pane_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -7846,6 +7936,7 @@ pub fn move_pane_with_pane_id_in_direction_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -7921,6 +8012,7 @@ pub fn clear_screen_for_pane_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -7996,6 +8088,7 @@ pub fn scroll_up_in_pane_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -8071,6 +8164,7 @@ pub fn scroll_down_in_pane_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -8146,6 +8240,7 @@ pub fn scroll_to_top_in_pane_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -8221,6 +8316,7 @@ pub fn scroll_to_bottom_in_pane_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -8296,6 +8392,7 @@ pub fn page_scroll_up_in_pane_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -8371,6 +8468,7 @@ pub fn page_scroll_down_in_pane_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -8446,6 +8544,7 @@ pub fn toggle_pane_id_fullscreen_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -8521,6 +8620,7 @@ pub fn toggle_pane_embed_or_eject_for_pane_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -8596,6 +8696,7 @@ pub fn close_tab_with_index_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -8671,6 +8772,7 @@ pub fn break_panes_to_new_tab_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -8746,6 +8848,7 @@ pub fn break_panes_to_tab_with_index_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -8821,6 +8924,7 @@ pub fn reload_plugin_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -8896,6 +9000,7 @@ pub fn load_new_plugin_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -8978,6 +9083,7 @@ pub fn rebind_keys_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -9056,6 +9162,7 @@ pub fn list_clients_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -9131,6 +9238,7 @@ pub fn before_close_plugin_event() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -9206,6 +9314,7 @@ pub fn show_cursor_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -9286,6 +9395,7 @@ pub fn hide_cursor_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -9365,6 +9475,7 @@ pub fn copy_to_clipboard_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -9444,6 +9555,7 @@ pub fn run_action_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -9533,6 +9645,7 @@ pub fn send_sigint_to_pane_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -9622,6 +9735,7 @@ pub fn send_sigkill_to_pane_id_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -9704,6 +9818,7 @@ pub fn copy_to_clipboard_without_permission() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -9790,6 +9905,7 @@ pub fn run_action_without_permission() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -9874,6 +9990,7 @@ pub fn generate_random_name_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -9963,6 +10080,7 @@ pub fn dump_layout_success_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -10052,6 +10170,7 @@ pub fn dump_layout_not_found_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -10141,6 +10260,7 @@ pub fn get_layout_dir_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -10230,6 +10350,7 @@ pub fn get_focused_pane_info_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -10314,6 +10435,7 @@ pub fn dump_session_layout_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -10397,6 +10519,7 @@ pub fn dump_session_layout_for_tab_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -10480,6 +10603,7 @@ pub fn parse_layout_success_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -10569,6 +10693,7 @@ pub fn parse_layout_error_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -10658,6 +10783,7 @@ pub fn save_layout_success_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -10747,6 +10873,7 @@ pub fn save_layout_already_exists_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -10850,6 +10977,7 @@ pub fn save_layout_with_overwrite_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -10939,6 +11067,7 @@ pub fn save_layout_invalid_kdl_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -11028,6 +11157,7 @@ pub fn rename_layout_success_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -11131,6 +11261,7 @@ pub fn rename_layout_not_found_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -11220,6 +11351,7 @@ pub fn delete_layout_success_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -11336,6 +11468,7 @@ pub fn delete_layout_not_found_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -11425,6 +11558,7 @@ pub fn save_layout_path_traversal_blocked_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -11527,6 +11661,7 @@ pub fn edit_layout_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -11617,6 +11752,7 @@ pub fn override_layout_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -11702,6 +11838,7 @@ pub fn generate_random_name_permission_denied() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -11798,6 +11935,7 @@ pub fn save_layout_permission_denied() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), @@ -11897,6 +12035,7 @@ pub fn plugin_receives_config_change_event() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin.clone(), Some(tab_index), @@ -12018,6 +12157,7 @@ pub fn plugin_does_not_receive_event_when_config_unchanged() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin.clone(), Some(tab_index), @@ -12133,6 +12273,7 @@ pub fn get_session_environment_variables_plugin_command() { let _ = plugin_thread_sender.send(PluginInstruction::Load( plugin_should_float, false, + false, // close_replaced_pane plugin_title, run_plugin, Some(tab_index), diff --git a/zellij-server/src/plugins/wasm_bridge.rs b/zellij-server/src/plugins/wasm_bridge.rs index bc1c6017..a83dbcc1 100644 --- a/zellij-server/src/plugins/wasm_bridge.rs +++ b/zellij-server/src/plugins/wasm_bridge.rs @@ -1774,6 +1774,7 @@ impl WasmBridge { drop(self.senders.send_to_screen(ScreenInstruction::AddPlugin( Some(should_float), should_be_open_in_place, + false, // close_replaced_pane run_plugin_or_alias, pane_title, None, diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs index dda441c8..3425d230 100644 --- a/zellij-server/src/plugins/zellij_exports.rs +++ b/zellij-server/src/plugins/zellij_exports.rs @@ -1304,6 +1304,7 @@ fn open_file(env: &PluginEnv, file_to_open: FileToOpen, context: BTreeMap<String direction: None, floating, in_place, + close_replaced_pane: false, start_suppressed, coordinates: None, near_current_pane: false, @@ -1405,6 +1406,7 @@ fn open_file_floating( direction: None, floating, in_place, + close_replaced_pane: false, start_suppressed, coordinates: floating_pane_coordinates, near_current_pane: false, @@ -1444,6 +1446,7 @@ fn open_file_in_place( direction: None, floating, in_place, + close_replaced_pane: false, start_suppressed, coordinates: None, near_current_pane: false, @@ -1756,7 +1759,7 @@ fn open_terminal_in_place(env: &PluginEnv, cwd: PathBuf) { pane_name: None, near_current_pane: false, pane_id_to_replace: None, - close_replace_pane: false, + close_replaced_pane: false, }; let result = apply_action!(action, error_msg, env); @@ -2257,7 +2260,7 @@ fn open_command_pane_in_place( pane_name: name, near_current_pane: false, pane_id_to_replace: None, - close_replace_pane: false, + close_replaced_pane: false, }; let result = apply_action!(action, error_msg, env); @@ -4132,6 +4135,7 @@ fn try_edit_layout( direction: None, floating: false, in_place: true, + close_replaced_pane: false, start_suppressed: false, coordinates: None, near_current_pane: true, @@ -4464,6 +4468,7 @@ fn load_new_plugin( let _ = env.senders.send_to_plugin(PluginInstruction::Load( should_float, should_be_open_in_place, + false, // close_replaced_pane pane_title, run_plugin_or_alias, tab_index, diff --git a/zellij-server/src/pty.rs b/zellij-server/src/pty.rs index 607638e6..90146a97 100644 --- a/zellij-server/src/pty.rs +++ b/zellij-server/src/pty.rs @@ -118,6 +118,7 @@ pub enum PtyInstruction { FillPluginCwd( Option<bool>, // should float bool, // should be opened in place + bool, // close_replaced_pane Option<String>, // pane title RunPluginOrAlias, usize, // tab index @@ -814,6 +815,7 @@ pub(crate) fn pty_thread_main(mut pty: Pty, layout: Box<Layout>) -> Result<()> { PtyInstruction::FillPluginCwd( should_float, should_be_open_in_place, + close_replaced_pane, pane_title, run, tab_index, @@ -829,6 +831,7 @@ pub(crate) fn pty_thread_main(mut pty: Pty, layout: Box<Layout>) -> Result<()> { pty.fill_plugin_cwd( should_float, should_be_open_in_place, + close_replaced_pane, pane_title, run, tab_index, @@ -1931,6 +1934,7 @@ impl Pty { &self, should_float: Option<bool>, should_open_in_place: bool, // should be opened in place + close_replaced_pane: bool, // close_replaced_pane pane_title: Option<String>, // pane title mut run: RunPluginOrAlias, tab_index: usize, // tab index @@ -1979,6 +1983,7 @@ impl Pty { self.bus.senders.send_to_plugin(PluginInstruction::Load( should_float, should_open_in_place, + close_replaced_pane, pane_title, run, Some(tab_index), diff --git a/zellij-server/src/route.rs b/zellij-server/src/route.rs index 4d03bd0b..8641da32 100644 --- a/zellij-server/src/route.rs +++ b/zellij-server/src/route.rs @@ -633,6 +633,7 @@ pub(crate) fn route_action( direction: split_direction, floating: should_float, in_place: should_open_in_place, + close_replaced_pane, start_suppressed, coordinates: floating_pane_coordinates, near_current_pane, @@ -644,14 +645,14 @@ pub(crate) fn route_action( Some(pane_id) if near_current_pane => PtyInstruction::SpawnInPlaceTerminal( Some(open_file), Some(title), - false, + close_replaced_pane, ClientTabIndexOrPaneId::PaneId(pane_id), Some(NotificationEnd::new(completion_tx)), ), _ => PtyInstruction::SpawnInPlaceTerminal( Some(open_file), Some(title), - false, + close_replaced_pane, ClientTabIndexOrPaneId::ClientId(client_id), Some(NotificationEnd::new(completion_tx)), ), @@ -740,7 +741,7 @@ pub(crate) fn route_action( pane_name: name, near_current_pane, pane_id_to_replace, - close_replace_pane, + close_replaced_pane, } => { let run_cmd = run_command .map(|cmd| TerminalAction::RunCommand(cmd.into())) @@ -755,7 +756,7 @@ pub(crate) fn route_action( .send_to_pty(PtyInstruction::SpawnInPlaceTerminal( run_cmd, name, - close_replace_pane, + close_replaced_pane, ClientTabIndexOrPaneId::PaneId(pane_id), Some(NotificationEnd::new(completion_tx)), )) @@ -766,7 +767,7 @@ pub(crate) fn route_action( .send_to_pty(PtyInstruction::SpawnInPlaceTerminal( run_cmd, name, - close_replace_pane, + close_replaced_pane, ClientTabIndexOrPaneId::ClientId(client_id), Some(NotificationEnd::new(completion_tx)), )) @@ -1284,6 +1285,7 @@ pub(crate) fn route_action( plugin: run_plugin, pane_name: name, skip_cache, + close_replaced_pane, } => { if let Some(pane_id) = pane_id { senders @@ -1292,6 +1294,7 @@ pub(crate) fn route_action( name, pane_id, skip_cache, + close_replaced_pane, client_id, Some(NotificationEnd::new(completion_tx)), )) @@ -1314,6 +1317,7 @@ pub(crate) fn route_action( should_float, move_to_focused_tab, should_open_in_place, + close_replaced_pane, skip_cache, } => { senders @@ -1322,6 +1326,7 @@ pub(crate) fn route_action( should_float, move_to_focused_tab, should_open_in_place, + close_replaced_pane, pane_id, skip_cache, client_id, @@ -1333,6 +1338,7 @@ pub(crate) fn route_action( plugin: run_plugin, should_float, should_open_in_place, + close_replaced_pane, skip_cache, cwd, } => { @@ -1341,6 +1347,7 @@ pub(crate) fn route_action( run_plugin, should_float, should_open_in_place, + close_replaced_pane, pane_id, skip_cache, cwd, diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index aeee332a..5adb2a93 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -469,14 +469,16 @@ pub enum ScreenInstruction { Option<String>, PaneId, bool, + bool, ClientId, Option<NotificationEnd>, ), // Option<String> is an - // optional pane title, bool is skip cache + // optional pane title, first bool is skip cache, second bool is close_replaced_pane StartOrReloadPluginPane(RunPluginOrAlias, Option<String>, Option<NotificationEnd>), AddPlugin( Option<bool>, // should_float bool, // should be opened in place + bool, // close_replaced_pane RunPluginOrAlias, Option<String>, // pane title Option<usize>, // tab index @@ -498,21 +500,23 @@ pub enum ScreenInstruction { bool, bool, bool, + bool, Option<PaneId>, bool, ClientId, Option<NotificationEnd>, - ), // bools are: should_float, move_to_focused_tab, should_open_in_place, Option<PaneId> is the pane id to replace, bool following it is skip_cache + ), // bools are: should_float, move_to_focused_tab, should_open_in_place, close_replaced_pane, Option<PaneId> is the pane id to replace, bool following it is skip_cache LaunchPlugin( RunPluginOrAlias, bool, bool, + bool, Option<PaneId>, bool, Option<PathBuf>, ClientId, Option<NotificationEnd>, - ), // bools are: should_float, should_open_in_place Option<PaneId> is the pane id to replace, Option<PathBuf> is an optional cwd, bool after is skip_cache + ), // bools are: should_float, should_open_in_place, close_replaced_pane, Option<PaneId> is the pane id to replace, Option<PathBuf> is an optional cwd, bool after is skip_cache SuppressPane(PaneId, ClientId), UnsuppressPane(PaneId, bool), // bool -> should float if hidden UnsuppressOrExpandPane(PaneId, bool), // bool -> should float if hidden @@ -5979,6 +5983,7 @@ pub(crate) fn screen_thread_main( .send_to_pty(PtyInstruction::FillPluginCwd( should_float, should_be_opened_in_place, + false, // close_replaced_pane pane_title, run_plugin, *tab_index, @@ -6011,6 +6016,7 @@ pub(crate) fn screen_thread_main( .send_to_pty(PtyInstruction::FillPluginCwd( should_float, should_be_opened_in_place, + false, // close_replaced_pane pane_title, run_plugin, *tab_index, @@ -6035,6 +6041,7 @@ pub(crate) fn screen_thread_main( pane_title, pane_id_to_replace, skip_cache, + close_replaced_pane, client_id, completion_tx, ) => match screen.active_tab_ids.values().next() { @@ -6048,6 +6055,7 @@ pub(crate) fn screen_thread_main( .send_to_pty(PtyInstruction::FillPluginCwd( should_float, should_be_in_place, + close_replaced_pane, pane_title, run_plugin, *tab_index, @@ -6087,6 +6095,7 @@ pub(crate) fn screen_thread_main( ScreenInstruction::AddPlugin( should_float, should_be_in_place, + close_replaced_pane, run_plugin_or_alias, pane_title, tab_index, @@ -6099,7 +6108,6 @@ pub(crate) fn screen_thread_main( client_id, mut completion_tx, ) => { - let close_replaced_pane = false; // TODO: support this let mut new_pane_placement = NewPanePlacement::default(); let maybe_should_float = should_float; let should_be_tiled = maybe_should_float.map(|f| !f).unwrap_or(false); @@ -6125,6 +6133,7 @@ pub(crate) fn screen_thread_main( pending_events_waiting_for_client.push(ScreenInstruction::AddPlugin( maybe_should_float, should_be_in_place, + close_replaced_pane, run_plugin_or_alias, pane_title, tab_index, @@ -6154,7 +6163,6 @@ pub(crate) fn screen_thread_main( completion.set_affected_pane_id(PaneId::Plugin(plugin_id)); } - let close_replaced_pane = false; if should_be_in_place { if let Some(pane_id_to_replace) = pane_id_to_replace { let client_tab_index_or_pane_id = @@ -6257,6 +6265,7 @@ pub(crate) fn screen_thread_main( should_float, move_to_focused_tab, should_open_in_place, + close_replaced_pane, pane_id_to_replace, skip_cache, client_id, @@ -6272,6 +6281,7 @@ pub(crate) fn screen_thread_main( .send_to_pty(PtyInstruction::FillPluginCwd( Some(should_float), should_open_in_place, + close_replaced_pane, None, run_plugin, *tab_index, @@ -6323,6 +6333,7 @@ pub(crate) fn screen_thread_main( .send_to_pty(PtyInstruction::FillPluginCwd( Some(should_float), should_open_in_place, + close_replaced_pane, None, run_plugin, tab_index, @@ -6347,6 +6358,7 @@ pub(crate) fn screen_thread_main( run_plugin, should_float, should_open_in_place, + close_replaced_pane, pane_id_to_replace, skip_cache, cwd, @@ -6362,6 +6374,7 @@ pub(crate) fn screen_thread_main( .send_to_pty(PtyInstruction::FillPluginCwd( Some(should_float), should_open_in_place, + close_replaced_pane, None, run_plugin, *tab_index, @@ -6401,6 +6414,7 @@ pub(crate) fn screen_thread_main( .send_to_pty(PtyInstruction::FillPluginCwd( Some(should_float), should_open_in_place, + close_replaced_pane, None, run_plugin, tab_index, diff --git a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__in_place_pane_with_close_replaced_pane_false_restores_original.snap b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__in_place_pane_with_close_replaced_pane_false_restores_original.snap new file mode 100644 index 00000000..1f4f91ed --- /dev/null +++ b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__in_place_pane_with_close_replaced_pane_false_restores_original.snap @@ -0,0 +1,24 @@ +--- +source: zellij-server/src/tab/./unit/tab_integration_tests.rs +expression: snapshot +--- +00 (C): ┌ Pane #1 ──────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐ +01 (C): │ ││ │ +02 (C): │ ││ │ +03 (C): │ ││ │ +04 (C): │I am pane one ││I am pane two │ +05 (C): │ ││ │ +06 (C): │ ││ │ +07 (C): │ ││ │ +08 (C): │ ││ │ +09 (C): │ ││ │ +10 (C): │ ││ │ +11 (C): │ ││ │ +12 (C): │ ││ │ +13 (C): │ ││ │ +14 (C): │ ││ │ +15 (C): │ ││ │ +16 (C): │ ││ │ +17 (C): │ ││ │ +18 (C): │ ││ │ +19 (C): └───────────────────────────────────────────────────────────┘└──────────────────────────────────────────────────────────┘ diff --git a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__in_place_pane_with_close_replaced_pane_true_closes_original.snap b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__in_place_pane_with_close_replaced_pane_true_closes_original.snap new file mode 100644 index 00000000..ad5e9568 --- /dev/null +++ b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__in_place_pane_with_close_replaced_pane_true_closes_original.snap @@ -0,0 +1,24 @@ +--- +source: zellij-server/src/tab/./unit/tab_integration_tests.rs +expression: snapshot +--- +00 (C): ┌ Pane #1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +01 (C): │ │ +02 (C): │ │ +03 (C): │ │ +04 (C): │I am pane one │ +05 (C): │ │ +06 (C): │ │ +07 (C): │ │ +08 (C): │ │ +09 (C): │ │ +10 (C): │ │ +11 (C): │ │ +12 (C): │ │ +13 (C): │ │ +14 (C): │ │ +15 (C): │ │ +16 (C): │ │ +17 (C): │ │ +18 (C): │ │ +19 (C): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ diff --git a/zellij-server/src/tab/unit/tab_integration_tests.rs b/zellij-server/src/tab/unit/tab_integration_tests.rs index d20e226a..97f79025 100644 --- a/zellij-server/src/tab/unit/tab_integration_tests.rs +++ b/zellij-server/src/tab/unit/tab_integration_tests.rs @@ -12327,3 +12327,128 @@ fn test_ctrl_scroll_down_decreases_pinned_floating_pane_size_when_floating_panes eprintln!("{}", snapshot_after); assert_snapshot!(format!("{}", snapshot_after)); } + +#[test] +fn in_place_pane_with_close_replaced_pane_false_restores_original() { + // When an in-place pane is closed and close_replaced_pane=false (the default), + // the pane that was replaced is restored to its original position. + let size = Size { + cols: 121, + rows: 20, + }; + let client_id = 1; + let mut tab = create_new_tab(size, ModeInfo::default()); + let mut output = Output::default(); + + // Create a second tiled pane so closing the in-place pane doesn't leave an empty tab + tab.new_pane( + PaneId::Terminal(2), + None, + None, + false, + false, + NewPanePlacement::Tiled { + direction: None, + borderless: None, + }, + Some(client_id), + None, + ) + .unwrap(); + + // Write distinguishing content to each pane + tab.handle_pty_bytes(1, Vec::from("\n\n\nI am pane one".as_bytes())) + .unwrap(); + tab.handle_pty_bytes(2, Vec::from("\n\n\nI am pane two".as_bytes())) + .unwrap(); + + // Open pane 3 in-place of pane 2 without closing the replaced pane (suppress it) + tab.new_in_place_pane( + PaneId::Terminal(3), + None, + None, + Some(PaneId::Terminal(2)), + false, // close_replaced_pane + Some(client_id), + None, + None, + ) + .unwrap(); + tab.handle_pty_bytes(3, Vec::from("\n\n\nI am the in-place pane".as_bytes())) + .unwrap(); + + // Close the in-place pane — pane 2 should be restored + tab.close_pane(PaneId::Terminal(3), false, None); + + tab.render(&mut output, None).unwrap(); + let snapshot = take_snapshot( + output.serialize().unwrap().get(&client_id).unwrap(), + size.rows, + size.cols, + Palette::default(), + ); + // Snapshot shows both pane 1 and the restored pane 2 + assert_snapshot!(snapshot); +} + +#[test] +fn in_place_pane_with_close_replaced_pane_true_closes_original() { + // When an in-place pane is closed and close_replaced_pane=true, + // the replaced pane is permanently destroyed rather than restored. + let size = Size { + cols: 121, + rows: 20, + }; + let client_id = 1; + let mut tab = create_new_tab(size, ModeInfo::default()); + let mut output = Output::default(); + + // Create a second tiled pane + tab.new_pane( + PaneId::Terminal(2), + None, + None, + false, + false, + NewPanePlacement::Tiled { + direction: None, + borderless: None, + }, + Some(client_id), + None, + ) + .unwrap(); + + tab.handle_pty_bytes(1, Vec::from("\n\n\nI am pane one".as_bytes())) + .unwrap(); + tab.handle_pty_bytes(2, Vec::from("\n\n\nI am pane two".as_bytes())) + .unwrap(); + + // Open pane 3 in-place of pane 2, closing the replaced pane permanently + tab.new_in_place_pane( + PaneId::Terminal(3), + None, + None, + Some(PaneId::Terminal(2)), + true, // close_replaced_pane + Some(client_id), + None, + None, + ) + .unwrap(); + tab.handle_pty_bytes(3, Vec::from("\n\n\nI am the in-place pane".as_bytes())) + .unwrap(); + + // Close the in-place pane — pane 2 should NOT be restored (it was closed) + tab.close_pane(PaneId::Terminal(3), false, None); + + tab.render(&mut output, None).unwrap(); + let snapshot = take_snapshot( + output.serialize().unwrap().get(&client_id).unwrap(), + size.rows, + size.cols, + Palette::default(), + ); + // Snapshot shows only pane 1 (pane 2 was permanently closed, not restored) + assert_snapshot!(snapshot); +} diff --git a/zellij-server/src/unit/screen_tests.rs b/zellij-server/src/unit/screen_tests.rs index 785fdbac..9ab7ec14 100644 --- a/zellij-server/src/unit/screen_tests.rs +++ b/zellij-server/src/unit/screen_tests.rs @@ -3003,6 +3003,7 @@ pub fn send_cli_new_pane_action_with_default_parameters() { cwd: None, floating: false, in_place: false, + close_replaced_pane: false, name: None, close_on_exit: false, start_suspended: false, @@ -3052,6 +3053,7 @@ pub fn send_cli_new_pane_action_with_split_direction() { cwd: None, floating: false, in_place: false, + close_replaced_pane: false, name: None, close_on_exit: false, start_suspended: false, @@ -3101,6 +3103,7 @@ pub fn send_cli_new_pane_action_with_command_and_cwd() { cwd: Some("/some/folder".into()), floating: false, in_place: false, + close_replaced_pane: false, name: None, close_on_exit: false, start_suspended: false, @@ -3161,6 +3164,7 @@ pub fn send_cli_new_pane_action_with_floating_pane_and_coordinates() { cwd: Some("/some/folder".into()), floating: true, in_place: false, + close_replaced_pane: false, name: None, close_on_exit: false, start_suspended: false, @@ -3209,6 +3213,7 @@ pub fn send_cli_edit_action_with_default_parameters() { line_number: None, floating: false, in_place: false, + close_replaced_pane: false, cwd: None, x: None, y: None, @@ -3250,6 +3255,7 @@ pub fn send_cli_edit_action_with_line_number() { line_number: Some(100), floating: false, in_place: false, + close_replaced_pane: false, cwd: None, x: None, y: None, @@ -3291,6 +3297,7 @@ pub fn send_cli_edit_action_with_split_direction() { line_number: None, floating: false, in_place: false, + close_replaced_pane: false, cwd: None, x: None, y: None, @@ -3369,24 +3376,31 @@ pub fn send_cli_toggle_pane_embed_or_float() { toggle_pane_embed_or_floating.clone(), client_id, ); - std::thread::sleep(std::time::Duration::from_millis(100)); + std::thread::sleep(std::time::Duration::from_millis(200)); // second time to embed send_cli_action_to_server( &session_metadata, toggle_pane_embed_or_floating.clone(), client_id, ); - std::thread::sleep(std::time::Duration::from_millis(100)); + std::thread::sleep(std::time::Duration::from_millis(200)); mock_screen.teardown(vec![server_instruction, screen_thread]); let snapshots = take_snapshots_and_cursor_coordinates_from_render_events( received_server_instructions.lock().unwrap().iter(), size, ); let snapshot_count = snapshots.len(); - for (_cursor_coordinates, snapshot) in snapshots { + let last_three_snapshots = snapshots.clone().into_iter().rev().take(3).rev(); // we do this to + // prevent extra + // renders from + // throwing us + // off + for (_cursor_coordinates, snapshot) in last_three_snapshots.clone() { + eprintln!("{}", snapshot); + } + for (_cursor_coordinates, snapshot) in last_three_snapshots { assert_snapshot!(format!("{}", snapshot)); } - assert_snapshot!(format!("{}", snapshot_count)); } #[test] @@ -3851,6 +3865,7 @@ pub fn send_cli_launch_or_focus_plugin_action() { let cli_action = CliAction::LaunchOrFocusPlugin { floating: true, in_place: false, + close_replaced_pane: false, move_to_focused_tab: true, url: "file:/path/to/fake/plugin".to_owned(), configuration: Default::default(), @@ -3912,6 +3927,7 @@ pub fn send_cli_launch_or_focus_plugin_action_when_plugin_is_already_loaded() { let cli_action = CliAction::LaunchOrFocusPlugin { floating: true, in_place: false, + close_replaced_pane: false, move_to_focused_tab: true, url: "file:/path/to/fake/plugin".to_owned(), configuration: Default::default(), @@ -3995,6 +4011,7 @@ pub fn send_cli_launch_or_focus_plugin_action_when_plugin_is_already_loaded_for_ let cli_action = CliAction::LaunchOrFocusPlugin { floating: true, in_place: false, + close_replaced_pane: false, move_to_focused_tab: true, url: "fixture_plugin_for_tests".to_owned(), configuration: Default::default(), @@ -4945,3 +4962,158 @@ pub fn send_cli_close_tab_by_id_action() { // The action should complete successfully assert!(true, "CloseTabById CLI action completed without errors"); } + +#[test] +pub fn send_cli_new_pane_in_place_with_close_replaced_pane() { + // Verify that `--close-replaced-pane` propagates from CLI through to the + // PtyInstruction::SpawnInPlaceTerminal instruction as `true`. + let size = Size { + cols: 121, + rows: 20, + }; + let client_id = 10; // fake client id should not appear in the screen's state + let mut mock_screen = MockScreen::new(size); + let pty_receiver = mock_screen.pty_receiver.take().unwrap(); + let session_metadata = mock_screen.clone_session_metadata(); + let screen_thread = mock_screen.run(None, vec![]); + let received_pty_instructions = Arc::new(Mutex::new(vec![])); + let pty_thread = log_actions_in_thread!( + received_pty_instructions, + PtyInstruction::Exit, + pty_receiver + ); + let cli_action = CliAction::NewPane { + direction: None, + command: vec!["bash".into()], + plugin: None, + cwd: None, + floating: false, + in_place: true, + close_replaced_pane: true, + name: None, + close_on_exit: false, + start_suspended: false, + configuration: None, + skip_plugin_cache: false, + x: None, + y: None, + width: None, + height: None, + pinned: None, + stacked: false, + blocking: false, + unblock_condition: None, + near_current_pane: false, + borderless: None, + }; + send_cli_action_to_server(&session_metadata, cli_action, client_id); + std::thread::sleep(std::time::Duration::from_millis(100)); + mock_screen.teardown(vec![pty_thread, screen_thread]); + + let spawn_in_place_instruction = received_pty_instructions + .lock() + .unwrap() + .iter() + .find(|instruction| match instruction { + PtyInstruction::SpawnInPlaceTerminal(..) => true, + _ => false, + }) + .cloned(); + + assert_snapshot!(format!("{:#?}", spawn_in_place_instruction)); +} + +#[test] +pub fn send_cli_edit_in_place_with_close_replaced_pane() { + let size = Size { + cols: 121, + rows: 20, + }; + let client_id = 10; // fake client id should not appear in the screen's state + let mut mock_screen = MockScreen::new(size); + let pty_receiver = mock_screen.pty_receiver.take().unwrap(); + let session_metadata = mock_screen.clone_session_metadata(); + let screen_thread = mock_screen.run(None, vec![]); + let received_pty_instructions = Arc::new(Mutex::new(vec![])); + let pty_thread = log_actions_in_thread!( + received_pty_instructions, + PtyInstruction::Exit, + pty_receiver + ); + let cli_action = CliAction::Edit { + file: PathBuf::from("/some/file.txt"), + direction: None, + line_number: None, + floating: false, + in_place: true, + close_replaced_pane: true, + cwd: None, + x: None, + y: None, + width: None, + height: None, + pinned: None, + near_current_pane: false, + borderless: None, + }; + send_cli_action_to_server(&session_metadata, cli_action, client_id); + std::thread::sleep(std::time::Duration::from_millis(100)); + mock_screen.teardown(vec![pty_thread, screen_thread]); + + let spawn_in_place_instruction = received_pty_instructions + .lock() + .unwrap() + .iter() + .find(|instruction| match instruction { + PtyInstruction::SpawnInPlaceTerminal(..) => true, + _ => false, + }) + .cloned(); + + assert_snapshot!(format!("{:#?}", spawn_in_place_instruction)); +} + +#[test] +pub fn send_cli_launch_or_focus_plugin_in_place_with_close_replaced_pane() { + // Verify that `--close-replaced-pane` propagates from the `launch-or-focus-plugin --in-place` + // CLI action through to the PtyInstruction::FillPluginCwd instruction as `true`. + let size = Size { + cols: 121, + rows: 20, + }; + let client_id = 10; // fake client id should not appear in the screen's state + let mut mock_screen = MockScreen::new(size); + let pty_receiver = mock_screen.pty_receiver.take().unwrap(); + let session_metadata = mock_screen.clone_session_metadata(); + let screen_thread = mock_screen.run(None, vec![]); + let received_pty_instructions = Arc::new(Mutex::new(vec![])); + let pty_thread = log_actions_in_thread!( + received_pty_instructions, + PtyInstruction::Exit, + pty_receiver + ); + let cli_action = CliAction::LaunchOrFocusPlugin { + floating: false, + in_place: true, + close_replaced_pane: true, + move_to_focused_tab: false, + url: "file:/path/to/fake/plugin".to_owned(), + configuration: Default::default(), + skip_plugin_cache: false, + }; + send_cli_action_to_server(&session_metadata, cli_action, client_id); + std::thread::sleep(std::time::Duration::from_millis(100)); + mock_screen.teardown(vec![pty_thread, screen_thread]); + + let fill_plugin_cwd_instruction = received_pty_instructions + .lock() + .unwrap() + .iter() + .find(|instruction| match instruction { + PtyInstruction::FillPluginCwd(..) => true, + _ => false, + }) + .cloned(); + + assert_snapshot!(format!("{:#?}", fill_plugin_cwd_instruction)); +} diff --git a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_edit_in_place_with_close_replaced_pane.snap b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_edit_in_place_with_close_replaced_pane.snap new file mode 100644 index 00000000..35b8f9cb --- /dev/null +++ b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_edit_in_place_with_close_replaced_pane.snap @@ -0,0 +1,36 @@ +--- +source: zellij-server/src/./unit/screen_tests.rs +expression: "format!(\"{:#?}\", spawn_in_place_instruction)" +--- +Some( + SpawnInPlaceTerminal( + Some( + OpenFile( + OpenFilePayload { + path: "/some/file.txt", + line_number: None, + cwd: Some( + ".", + ), + originating_plugin: None, + }, + ), + ), + Some( + "Editing: /some/file.txt", + ), + true, + ClientId( + 10, + ), + Some( + NotificationEnd { + channel: None, + exit_status: None, + unblock_condition: None, + affected_pane_id: None, + affected_tab_id: None, + }, + ), + ), +) diff --git a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_launch_or_focus_plugin_action.snap b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_launch_or_focus_plugin_action.snap index adb6d614..7b3226d9 100644 --- a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_launch_or_focus_plugin_action.snap +++ b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_launch_or_focus_plugin_action.snap @@ -8,6 +8,7 @@ Some( true, ), false, + false, None, RunPlugin( RunPlugin { diff --git a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_launch_or_focus_plugin_in_place_with_close_replaced_pane.snap b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_launch_or_focus_plugin_in_place_with_close_replaced_pane.snap new file mode 100644 index 00000000..cb65be5b --- /dev/null +++ b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_launch_or_focus_plugin_in_place_with_close_replaced_pane.snap @@ -0,0 +1,46 @@ +--- +source: zellij-server/src/./unit/screen_tests.rs +expression: "format!(\"{:#?}\", fill_plugin_cwd_instruction)" +--- +Some( + FillPluginCwd( + Some( + false, + ), + true, + true, + None, + RunPlugin( + RunPlugin { + _allow_exec_host_cmd: false, + location: File( + "/path/to/fake/plugin", + ), + configuration: PluginUserConfiguration( + {}, + ), + initial_cwd: None, + }, + ), + 0, + None, + 1, + Size { + rows: 0, + cols: 0, + }, + false, + None, + None, + None, + Some( + NotificationEnd { + channel: None, + exit_status: None, + unblock_condition: None, + affected_pane_id: None, + affected_tab_id: None, + }, + ), + ), +) diff --git a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_new_pane_in_place_with_close_replaced_pane.snap b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_new_pane_in_place_with_close_replaced_pane.snap new file mode 100644 index 00000000..209981ae --- /dev/null +++ b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_new_pane_in_place_with_close_replaced_pane.snap @@ -0,0 +1,37 @@ +--- +source: zellij-server/src/./unit/screen_tests.rs +expression: "format!(\"{:#?}\", spawn_in_place_instruction)" +--- +Some( + SpawnInPlaceTerminal( + Some( + RunCommand( + RunCommand { + command: "bash", + args: [], + cwd: Some( + ".", + ), + hold_on_close: true, + hold_on_start: false, + originating_plugin: None, + use_terminal_title: false, + }, + ), + ), + None, + true, + ClientId( + 10, + ), + Some( + NotificationEnd { + channel: None, + exit_status: None, + unblock_condition: None, + affected_pane_id: None, + affected_tab_id: None, + }, + ), + ), +) 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 { |
