From 326c8cd3c6566e8fa4acd3a9369c718ce96f6625 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Thu, 8 Feb 2024 17:35:55 +0100 Subject: feat(panes): allow specifying coordinates for a new floating pane through the CLI or plugins (#3122) * working * add tests * add coordinates to all the places * refactor: move things around: * style(fmt): rustfmt * style(code): cleanups --- .../fixture-plugin-for-tests/src/main.rs | 38 +- default-plugins/strider/src/search/search_state.rs | 26 +- src/main.rs | 24 ++ ..._open_command_pane_floating_plugin_command.snap | 3 +- ...in_tests__open_command_pane_plugin_command.snap | 3 +- ...n_tests__open_file_floating_plugin_command.snap | 1 + ...ns__plugin_tests__open_file_plugin_command.snap | 3 +- ...pen_file_with_line_floating_plugin_command.snap | 3 +- ..._tests__open_file_with_line_plugin_command.snap | 3 +- ...sts__open_terminal_floating_plugin_command.snap | 3 +- ...plugin_tests__open_terminal_plugin_command.snap | 3 +- zellij-server/src/plugins/zellij_exports.rs | 44 ++- zellij-server/src/pty.rs | 9 + zellij-server/src/route.rs | 23 +- zellij-server/src/screen.rs | 38 +- zellij-server/src/tab/mod.rs | 23 +- .../src/tab/unit/tab_integration_tests.rs | 412 +++++++++++---------- zellij-server/src/tab/unit/tab_tests.rs | 24 +- zellij-server/src/unit/screen_tests.rs | 142 ++++++- ...nd_cli_edit_action_with_default_parameters.snap | 4 +- ...sts__send_cli_edit_action_with_line_number.snap | 4 +- ...ts__send_cli_launch_or_focus_plugin_action.snap | 3 +- ...li_new_pane_action_with_default_parameters.snap | 4 +- ..._action_with_floating_pane_and_coordinates.snap | 6 + zellij-tile/src/shim.rs | 20 +- zellij-utils/assets/plugins/compact-bar.wasm | Bin 873526 -> 887621 bytes .../assets/plugins/fixture-plugin-for-tests.wasm | Bin 857362 -> 873465 bytes zellij-utils/assets/plugins/session-manager.wasm | Bin 868274 -> 926195 bytes zellij-utils/assets/plugins/status-bar.wasm | Bin 1025354 -> 1029901 bytes zellij-utils/assets/plugins/strider.wasm | Bin 2100620 -> 2109959 bytes zellij-utils/assets/plugins/tab-bar.wasm | Bin 843400 -> 868307 bytes zellij-utils/assets/prost/api.plugin_command.rs | 50 +++ zellij-utils/src/cli.rs | 63 +++- zellij-utils/src/data.rs | 89 ++++- zellij-utils/src/input/actions.rs | 34 +- zellij-utils/src/input/layout.rs | 11 + zellij-utils/src/kdl/mod.rs | 22 +- zellij-utils/src/pane_size.rs | 51 ++- zellij-utils/src/plugin_api/action.rs | 23 +- zellij-utils/src/plugin_api/plugin_command.proto | 19 + zellij-utils/src/plugin_api/plugin_command.rs | 187 ++++++++-- 41 files changed, 1078 insertions(+), 337 deletions(-) create mode 100644 zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_new_pane_action_with_floating_pane_and_coordinates.snap diff --git a/default-plugins/fixture-plugin-for-tests/src/main.rs b/default-plugins/fixture-plugin-for-tests/src/main.rs index 17f299435..fe740f740 100644 --- a/default-plugins/fixture-plugin-for-tests/src/main.rs +++ b/default-plugins/fixture-plugin-for-tests/src/main.rs @@ -167,10 +167,13 @@ impl ZellijPlugin for State { }); }, Key::Ctrl('h') => { - open_file_floating(FileToOpen { - path: std::path::PathBuf::from("/path/to/my/file.rs"), - ..Default::default() - }); + open_file_floating( + FileToOpen { + path: std::path::PathBuf::from("/path/to/my/file.rs"), + ..Default::default() + }, + None, + ); }, Key::Ctrl('i') => { open_file(FileToOpen { @@ -180,11 +183,14 @@ impl ZellijPlugin for State { }); }, Key::Ctrl('j') => { - open_file_floating(FileToOpen { - path: std::path::PathBuf::from("/path/to/my/file.rs"), - line_number: Some(42), - ..Default::default() - }); + open_file_floating( + FileToOpen { + path: std::path::PathBuf::from("/path/to/my/file.rs"), + line_number: Some(42), + ..Default::default() + }, + None, + ); }, Key::Ctrl('k') => { open_terminal(std::path::PathBuf::from("/path/to/my/file.rs").as_path()); @@ -192,6 +198,7 @@ impl ZellijPlugin for State { Key::Ctrl('l') => { open_terminal_floating( std::path::PathBuf::from("/path/to/my/file.rs").as_path(), + None, ); }, Key::Ctrl('m') => { @@ -202,11 +209,14 @@ impl ZellijPlugin for State { }); }, Key::Ctrl('n') => { - open_command_pane_floating(CommandToRun { - path: std::path::PathBuf::from("/path/to/my/file.rs"), - args: vec!["arg1".to_owned(), "arg2".to_owned()], - ..Default::default() - }); + open_command_pane_floating( + CommandToRun { + path: std::path::PathBuf::from("/path/to/my/file.rs"), + args: vec!["arg1".to_owned(), "arg2".to_owned()], + ..Default::default() + }, + None, + ); }, Key::Ctrl('o') => { switch_tab_to(1); diff --git a/default-plugins/strider/src/search/search_state.rs b/default-plugins/strider/src/search/search_state.rs index 834a74fe6..60d03941d 100644 --- a/default-plugins/strider/src/search/search_state.rs +++ b/default-plugins/strider/src/search/search_state.rs @@ -88,10 +88,13 @@ impl SearchState { match self.selected_search_result_entry() { Some(SearchResult::File { path, .. }) => { if self.should_open_floating { - open_file_floating(FileToOpen { - path: PathBuf::from(path), - ..Default::default() - }); + open_file_floating( + FileToOpen { + path: PathBuf::from(path), + ..Default::default() + }, + None, + ); } else { open_file(FileToOpen { path: PathBuf::from(path), @@ -103,11 +106,14 @@ impl SearchState { path, line_number, .. }) => { if self.should_open_floating { - open_file_floating(FileToOpen { - path: PathBuf::from(path), - line_number: Some(line_number), - ..Default::default() - }); + open_file_floating( + FileToOpen { + path: PathBuf::from(path), + line_number: Some(line_number), + ..Default::default() + }, + None, + ); } else { open_file(FileToOpen { path: PathBuf::from(path), @@ -132,7 +138,7 @@ impl SearchState { { let dir_path = dir_path_of_result(&path); if self.should_open_floating { - open_terminal_floating(&dir_path); + open_terminal_floating(&dir_path, None); } else { open_terminal(&dir_path); } diff --git a/src/main.rs b/src/main.rs index 30770405e..871d468fe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,6 +29,10 @@ fn main() { name, close_on_exit, start_suspended, + x, + y, + width, + height, })) = opts.command { let cwd = cwd.or_else(|| std::env::current_dir().ok()); @@ -45,6 +49,10 @@ fn main() { start_suspended, configuration: None, skip_plugin_cache, + x, + y, + width, + height, }; commands::send_action_to_session(command_cli_action, opts.session, config); std::process::exit(0); @@ -55,6 +63,10 @@ fn main() { in_place, configuration, skip_plugin_cache, + x, + y, + width, + height, })) = opts.command { let cwd = std::env::current_dir().ok(); @@ -70,6 +82,10 @@ fn main() { start_suspended: false, configuration, skip_plugin_cache, + x, + y, + width, + height, }; commands::send_action_to_session(command_cli_action, opts.session, config); std::process::exit(0); @@ -81,6 +97,10 @@ fn main() { floating, in_place, cwd, + x, + y, + width, + height, })) = opts.command { let mut file = file; @@ -97,6 +117,10 @@ fn main() { floating, in_place, cwd, + x, + y, + width, + height, }; commands::send_action_to_session(command_cli_action, opts.session, config); std::process::exit(0); diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_command_pane_floating_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_command_pane_floating_plugin_command.snap index a222f4faf..a1ab04754 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_command_pane_floating_plugin_command.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_command_pane_floating_plugin_command.snap @@ -1,6 +1,6 @@ --- source: zellij-server/src/plugins/./unit/plugin_tests.rs -assertion_line: 3198 +assertion_line: 4400 expression: "format!(\"{:#?}\", new_tab_event)" --- Some( @@ -23,6 +23,7 @@ Some( true, ), None, + None, ClientId( 1, ), diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_command_pane_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_command_pane_plugin_command.snap index 2807e4952..935f72bbe 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_command_pane_plugin_command.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_command_pane_plugin_command.snap @@ -1,6 +1,6 @@ --- source: zellij-server/src/plugins/./unit/plugin_tests.rs -assertion_line: 3144 +assertion_line: 4323 expression: "format!(\"{:#?}\", new_tab_event)" --- Some( @@ -23,6 +23,7 @@ Some( false, ), None, + None, ClientId( 1, ), diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_floating_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_floating_plugin_command.snap index daff15fa6..9a1ffe587 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_floating_plugin_command.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_floating_plugin_command.snap @@ -20,6 +20,7 @@ Some( Some( "Editing: /path/to/my/file.rs", ), + None, ClientId( 1, ), diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_plugin_command.snap index f895c55ce..b24094af5 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_plugin_command.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_plugin_command.snap @@ -1,6 +1,6 @@ --- source: zellij-server/src/plugins/./unit/plugin_tests.rs -assertion_line: 3925 +assertion_line: 3927 expression: "format!(\"{:#?}\",\n new_tab_event).replace(&format!(\"{:?}\", temp_folder.path()),\n \"\\\"CWD\\\"\")" --- Some( @@ -20,6 +20,7 @@ Some( Some( "Editing: /path/to/my/file.rs", ), + None, ClientId( 1, ), diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_floating_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_floating_plugin_command.snap index da0a726e5..dca771df8 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_floating_plugin_command.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_floating_plugin_command.snap @@ -1,6 +1,6 @@ --- source: zellij-server/src/plugins/./unit/plugin_tests.rs -assertion_line: 4076 +assertion_line: 4090 expression: "format!(\"{:#?}\",\n new_tab_event).replace(&format!(\"{:?}\", temp_folder.path()),\n \"\\\"CWD\\\"\")" --- Some( @@ -22,6 +22,7 @@ Some( Some( "Editing: /path/to/my/file.rs", ), + None, ClientId( 1, ), diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_plugin_command.snap index ee8feb31a..fd9d8e82e 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_plugin_command.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_file_with_line_plugin_command.snap @@ -1,6 +1,6 @@ --- source: zellij-server/src/plugins/./unit/plugin_tests.rs -assertion_line: 3999 +assertion_line: 4009 expression: "format!(\"{:#?}\",\n new_tab_event).replace(&format!(\"{:?}\", temp_folder.path()),\n \"\\\"CWD\\\"\")" --- Some( @@ -22,6 +22,7 @@ Some( Some( "Editing: /path/to/my/file.rs", ), + None, ClientId( 1, ), diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_terminal_floating_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_terminal_floating_plugin_command.snap index c43958a73..4c752eff9 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_terminal_floating_plugin_command.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_terminal_floating_plugin_command.snap @@ -1,6 +1,6 @@ --- source: zellij-server/src/plugins/./unit/plugin_tests.rs -assertion_line: 3090 +assertion_line: 4246 expression: "format!(\"{:#?}\", new_tab_event)" --- Some( @@ -22,6 +22,7 @@ Some( true, ), None, + None, ClientId( 1, ), diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_terminal_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_terminal_plugin_command.snap index 88fdd2edf..7c0fb608b 100644 --- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_terminal_plugin_command.snap +++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__open_terminal_plugin_command.snap @@ -1,6 +1,6 @@ --- source: zellij-server/src/plugins/./unit/plugin_tests.rs -assertion_line: 3036 +assertion_line: 4169 expression: "format!(\"{:#?}\", new_tab_event)" --- Some( @@ -22,6 +22,7 @@ Some( false, ), None, + None, ClientId( 1, ), diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs index 4d203afd3..19bac2822 100644 --- a/zellij-server/src/plugins/zellij_exports.rs +++ b/zellij-server/src/plugins/zellij_exports.rs @@ -18,8 +18,8 @@ use std::{ use wasmer::{imports, AsStoreMut, Function, FunctionEnv, FunctionEnvMut, Imports}; use wasmer_wasi::WasiEnv; use zellij_utils::data::{ - CommandType, ConnectToSession, HttpVerb, LayoutInfo, MessageToPlugin, PermissionStatus, - PermissionType, PluginPermission, + CommandType, ConnectToSession, FloatingPaneCoordinates, HttpVerb, LayoutInfo, MessageToPlugin, + PermissionStatus, PermissionType, PluginPermission, }; use zellij_utils::input::permission::PermissionCache; use zellij_utils::{ @@ -117,19 +117,20 @@ fn host_run_plugin_command(env: FunctionEnvMut) { PluginCommand::GetPluginIds => get_plugin_ids(env), PluginCommand::GetZellijVersion => get_zellij_version(env), PluginCommand::OpenFile(file_to_open) => open_file(env, file_to_open), - PluginCommand::OpenFileFloating(file_to_open) => { - open_file_floating(env, file_to_open) + PluginCommand::OpenFileFloating(file_to_open, floating_pane_coordinates) => { + open_file_floating(env, file_to_open, floating_pane_coordinates) }, PluginCommand::OpenTerminal(cwd) => open_terminal(env, cwd.path.try_into()?), - PluginCommand::OpenTerminalFloating(cwd) => { - open_terminal_floating(env, cwd.path.try_into()?) + PluginCommand::OpenTerminalFloating(cwd, floating_pane_coordinates) => { + open_terminal_floating(env, cwd.path.try_into()?, floating_pane_coordinates) }, PluginCommand::OpenCommandPane(command_to_run) => { open_command_pane(env, command_to_run) }, - PluginCommand::OpenCommandPaneFloating(command_to_run) => { - open_command_pane_floating(env, command_to_run) - }, + PluginCommand::OpenCommandPaneFloating( + command_to_run, + floating_pane_coordinates, + ) => open_command_pane_floating(env, command_to_run, floating_pane_coordinates), PluginCommand::SwitchTabTo(tab_index) => switch_tab_to(env, tab_index), PluginCommand::SetTimeout(seconds) => set_timeout(env, seconds), PluginCommand::ExecCmd(command_line) => exec_cmd(env, command_line), @@ -447,11 +448,16 @@ fn open_file(env: &ForeignFunctionEnv, file_to_open: FileToOpen) { None, floating, in_place, + None, ); apply_action!(action, error_msg, env); } -fn open_file_floating(env: &ForeignFunctionEnv, file_to_open: FileToOpen) { +fn open_file_floating( + env: &ForeignFunctionEnv, + file_to_open: FileToOpen, + floating_pane_coordinates: Option, +) { let error_msg = || format!("failed to open file in plugin {}", env.plugin_env.name()); let floating = true; let in_place = false; @@ -467,6 +473,7 @@ fn open_file_floating(env: &ForeignFunctionEnv, file_to_open: FileToOpen) { None, floating, in_place, + floating_pane_coordinates, ); apply_action!(action, error_msg, env); } @@ -488,6 +495,7 @@ fn open_file_in_place(env: &ForeignFunctionEnv, file_to_open: FileToOpen) { None, floating, in_place, + None, ); apply_action!(action, error_msg, env); } @@ -509,7 +517,11 @@ fn open_terminal(env: &ForeignFunctionEnv, cwd: PathBuf) { apply_action!(action, error_msg, env); } -fn open_terminal_floating(env: &ForeignFunctionEnv, cwd: PathBuf) { +fn open_terminal_floating( + env: &ForeignFunctionEnv, + cwd: PathBuf, + floating_pane_coordinates: Option, +) { let error_msg = || format!("failed to open file in plugin {}", env.plugin_env.name()); let cwd = env.plugin_env.plugin_cwd.join(cwd); let mut default_shell = env @@ -522,7 +534,7 @@ fn open_terminal_floating(env: &ForeignFunctionEnv, cwd: PathBuf) { TerminalAction::RunCommand(run_command) => Some(run_command.into()), _ => None, }; - let action = Action::NewFloatingPane(run_command_action, None); + let action = Action::NewFloatingPane(run_command_action, None, floating_pane_coordinates); apply_action!(action, error_msg, env); } @@ -566,7 +578,11 @@ fn open_command_pane(env: &ForeignFunctionEnv, command_to_run: CommandToRun) { apply_action!(action, error_msg, env); } -fn open_command_pane_floating(env: &ForeignFunctionEnv, command_to_run: CommandToRun) { +fn open_command_pane_floating( + env: &ForeignFunctionEnv, + command_to_run: CommandToRun, + floating_pane_coordinates: Option, +) { let error_msg = || format!("failed to open command in plugin {}", env.plugin_env.name()); let command = command_to_run.path; let cwd = command_to_run @@ -585,7 +601,7 @@ fn open_command_pane_floating(env: &ForeignFunctionEnv, command_to_run: CommandT hold_on_close, hold_on_start, }; - let action = Action::NewFloatingPane(Some(run_command_action), name); + let action = Action::NewFloatingPane(Some(run_command_action), name, floating_pane_coordinates); apply_action!(action, error_msg, env); } diff --git a/zellij-server/src/pty.rs b/zellij-server/src/pty.rs index 8562044cd..0f9001a2f 100644 --- a/zellij-server/src/pty.rs +++ b/zellij-server/src/pty.rs @@ -13,6 +13,7 @@ use std::{collections::HashMap, os::unix::io::RawFd, path::PathBuf}; use zellij_utils::nix::unistd::Pid; use zellij_utils::{ async_std, + data::FloatingPaneCoordinates, errors::prelude::*, errors::{ContextType, PtyContext}, input::{ @@ -43,6 +44,7 @@ pub enum PtyInstruction { Option, Option, Option, + Option, ClientTabIndexOrPaneId, ), // bool (if Some) is // should_float, String is an optional pane name @@ -90,6 +92,7 @@ pub enum PtyInstruction { Size, bool, // skip cache Option, // if Some, will not fill cwd but just forward the message + Option, ), Exit, } @@ -135,6 +138,7 @@ pub(crate) fn pty_thread_main(mut pty: Pty, layout: Box) -> Result<()> { terminal_action, should_float, name, + floating_pane_coordinates, client_or_tab_index, ) => { let err_context = @@ -176,6 +180,7 @@ pub(crate) fn pty_thread_main(mut pty: Pty, layout: Box) -> Result<()> { should_float, hold_for_command, invoked_with, + floating_pane_coordinates, client_or_tab_index, )) .with_context(err_context)?; @@ -192,6 +197,7 @@ pub(crate) fn pty_thread_main(mut pty: Pty, layout: Box) -> Result<()> { should_float, hold_for_command, invoked_with, + floating_pane_coordinates, client_or_tab_index, )) .with_context(err_context)?; @@ -657,6 +663,7 @@ pub(crate) fn pty_thread_main(mut pty: Pty, layout: Box) -> Result<()> { size, skip_cache, cwd, + floating_pane_coordinates, ) => { pty.fill_plugin_cwd( should_float, @@ -669,6 +676,7 @@ pub(crate) fn pty_thread_main(mut pty: Pty, layout: Box) -> Result<()> { size, skip_cache, cwd, + floating_pane_coordinates, )?; }, PtyInstruction::Exit => break, @@ -1336,6 +1344,7 @@ impl Pty { size: Size, skip_cache: bool, cwd: Option, + floating_pane_coordinates: Option, ) -> Result<()> { let cwd = cwd.or_else(|| { self.active_panes diff --git a/zellij-server/src/route.rs b/zellij-server/src/route.rs index 471d90aac..0dd2946ca 100644 --- a/zellij-server/src/route.rs +++ b/zellij-server/src/route.rs @@ -268,6 +268,7 @@ pub(crate) fn route_action( shell, None, name, + None, ClientTabIndexOrPaneId::ClientId(client_id), ), }; @@ -280,6 +281,7 @@ pub(crate) fn route_action( split_direction, should_float, should_open_in_place, + floating_pane_coordinates, ) => { let title = format!("Editing: {}", path_to_file.display()); let open_file = TerminalAction::OpenFile(path_to_file, line_number, cwd); @@ -319,6 +321,7 @@ pub(crate) fn route_action( Some(open_file), Some(should_float), Some(title), + floating_pane_coordinates, ClientTabIndexOrPaneId::ClientId(client_id), ), }; @@ -341,7 +344,7 @@ pub(crate) fn route_action( ))) .with_context(err_context)?; }, - Action::NewFloatingPane(run_command, name) => { + Action::NewFloatingPane(run_command, name, floating_pane_coordinates) => { let should_float = true; let run_cmd = run_command .map(|cmd| TerminalAction::RunCommand(cmd.into())) @@ -351,6 +354,7 @@ pub(crate) fn route_action( run_cmd, Some(should_float), name, + floating_pane_coordinates, ClientTabIndexOrPaneId::ClientId(client_id), )) .with_context(err_context)?; @@ -403,6 +407,7 @@ pub(crate) fn route_action( run_cmd, Some(should_float), name, + None, ClientTabIndexOrPaneId::ClientId(client_id), ), }; @@ -451,6 +456,7 @@ pub(crate) fn route_action( run_cmd, None, None, + None, ClientTabIndexOrPaneId::ClientId(client_id), ), }; @@ -666,10 +672,21 @@ pub(crate) fn route_action( )) .with_context(err_context)?; }, - Action::NewFloatingPluginPane(run_plugin, name, skip_cache, cwd) => { + Action::NewFloatingPluginPane( + run_plugin, + name, + skip_cache, + cwd, + floating_pane_coordinates, + ) => { senders .send_to_screen(ScreenInstruction::NewFloatingPluginPane( - run_plugin, name, skip_cache, cwd, client_id, + run_plugin, + name, + skip_cache, + cwd, + floating_pane_coordinates, + client_id, )) .with_context(err_context)?; }, diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index 69e1b6bf2..fa8030072 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -46,7 +46,10 @@ use crate::{ ClientId, ServerInstruction, }; use zellij_utils::{ - data::{Event, InputMode, ModeInfo, Palette, PaletteColor, PluginCapabilities, Style, TabInfo}, + data::{ + Event, FloatingPaneCoordinates, InputMode, ModeInfo, Palette, PaletteColor, + PluginCapabilities, Style, TabInfo, + }, errors::{ContextType, ScreenContext}, input::{get_mode_info, options::Options}, ipc::{ClientAttributes, PixelDimensions, ServerToClientMsg}, @@ -146,6 +149,7 @@ pub enum ScreenInstruction { Option, HoldForCommand, Option, // invoked with + Option, ClientTabIndexOrPaneId, ), OpenInPlaceEditor(PaneId, ClientId), @@ -274,7 +278,14 @@ pub enum ScreenInstruction { QueryTabNames(ClientId), NewTiledPluginPane(RunPlugin, Option, bool, Option, ClientId), // Option is // optional pane title, bool is skip cache, Option is an optional cwd - NewFloatingPluginPane(RunPlugin, Option, bool, Option, ClientId), // Option is an + NewFloatingPluginPane( + RunPlugin, + Option, + bool, + Option, + Option, + ClientId, + ), // Option is an // optional pane title, bool // is skip cache, Option is an optional cwd NewInPlacePluginPane(RunPlugin, Option, PaneId, bool, ClientId), // Option is an @@ -1760,6 +1771,7 @@ impl Screen { new_active_tab.add_floating_pane( plugin_pane_to_move_to_active_tab, pane_id, + None, Some(client_id), )?; } else { @@ -1844,7 +1856,7 @@ impl Screen { let (mut tiled_panes_layout, mut floating_panes_layout) = default_layout.new_tab(); if pane_to_break_is_floating { tab.show_floating_panes(); - tab.add_floating_pane(active_pane, active_pane_id, Some(client_id))?; + tab.add_floating_pane(active_pane, active_pane_id, None, Some(client_id))?; if let Some(already_running_layout) = floating_panes_layout .iter_mut() .find(|i| i.run == active_pane_run_instruction) @@ -1909,7 +1921,12 @@ impl Screen { if pane_to_break_is_floating { new_active_tab.show_floating_panes(); - new_active_tab.add_floating_pane(active_pane, active_pane_id, Some(client_id))?; + new_active_tab.add_floating_pane( + active_pane, + active_pane_id, + None, + Some(client_id), + )?; } else { new_active_tab.hide_floating_panes(); new_active_tab.add_tiled_pane(active_pane, active_pane_id, Some(client_id))?; @@ -2217,6 +2234,7 @@ pub(crate) fn screen_thread_main( should_float, hold_for_command, invoked_with, + floating_pane_coordinates, client_or_tab_index, ) => { match client_or_tab_index { @@ -2226,6 +2244,7 @@ pub(crate) fn screen_thread_main( initial_pane_title, should_float, invoked_with, + floating_pane_coordinates, Some(client_id) ) }, ?); @@ -2250,6 +2269,7 @@ pub(crate) fn screen_thread_main( initial_pane_title, should_float, invoked_with, + floating_pane_coordinates, None, )?; if let Some(hold_for_command) = hold_for_command { @@ -3241,6 +3261,7 @@ pub(crate) fn screen_thread_main( size, skip_cache, cwd, + None, ))?; }, ScreenInstruction::NewFloatingPluginPane( @@ -3248,6 +3269,7 @@ pub(crate) fn screen_thread_main( pane_title, skip_cache, cwd, + floating_pane_coordinates, client_id, ) => match screen.active_tab_indices.values().next() { Some(tab_index) => { @@ -3268,6 +3290,7 @@ pub(crate) fn screen_thread_main( size, skip_cache, cwd, + floating_pane_coordinates, ))?; }, None => { @@ -3301,6 +3324,7 @@ pub(crate) fn screen_thread_main( size, skip_cache, None, + None, ))?; }, None => { @@ -3378,6 +3402,7 @@ pub(crate) fn screen_thread_main( should_float, Some(run_plugin), None, + None, ) }, ?); } else if let Some(active_tab) = @@ -3389,6 +3414,7 @@ pub(crate) fn screen_thread_main( should_float, Some(run_plugin), None, + None, )?; } else { log::error!("Tab index not found: {:?}", tab_index); @@ -3462,6 +3488,7 @@ pub(crate) fn screen_thread_main( size, skip_cache, None, + None, ))?; }, None => { @@ -3507,6 +3534,7 @@ pub(crate) fn screen_thread_main( Size::default(), skip_cache, None, + None, ))?; } }, @@ -3542,6 +3570,7 @@ pub(crate) fn screen_thread_main( size, skip_cache, cwd, + None, ))?; }, None => { @@ -3578,6 +3607,7 @@ pub(crate) fn screen_thread_main( Size::default(), skip_cache, cwd, + None, ))?; }, None => { diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs index 2ed9eb35b..de1becccd 100644 --- a/zellij-server/src/tab/mod.rs +++ b/zellij-server/src/tab/mod.rs @@ -46,7 +46,7 @@ use std::{ str, }; use zellij_utils::{ - data::{Event, InputMode, ModeInfo, Palette, PaletteColor, Style}, + data::{Event, FloatingPaneCoordinates, InputMode, ModeInfo, Palette, PaletteColor, Style}, input::{ command::TerminalAction, layout::{ @@ -991,7 +991,12 @@ impl Tab { self.close_pane(focused_pane_id, true, Some(client_id)) { self.show_floating_panes(); - self.add_floating_pane(embedded_pane_to_float, focused_pane_id, Some(client_id))?; + self.add_floating_pane( + embedded_pane_to_float, + focused_pane_id, + None, + Some(client_id), + )?; } } Ok(()) @@ -1030,6 +1035,7 @@ impl Tab { default_shell, Some(should_float), name, + None, client_id_or_tab_index, ); self.senders @@ -1048,6 +1054,7 @@ impl Tab { initial_pane_title: Option, should_float: Option, invoked_with: Option, + floating_pane_coordinates: Option, client_id: Option, ) -> Result<()> { let err_context = || format!("failed to create new pane with id {pid:?}"); @@ -1105,7 +1112,7 @@ impl Tab { }, }; if self.floating_panes.panes_are_visible() { - self.add_floating_pane(new_pane, pid, client_id) + self.add_floating_pane(new_pane, pid, floating_pane_coordinates, client_id) } else { self.add_tiled_pane(new_pane, pid, client_id) } @@ -3615,7 +3622,7 @@ impl Tab { Some(pane) => { if should_float { self.show_floating_panes(); - self.add_floating_pane(pane.1, pane_id, Some(client_id)) + self.add_floating_pane(pane.1, pane_id, None, Some(client_id)) } else { self.hide_floating_panes(); self.add_tiled_pane(pane.1, pane_id, Some(client_id)) @@ -3655,10 +3662,16 @@ impl Tab { &mut self, mut pane: Box, pane_id: PaneId, + floating_pane_coordinates: Option, client_id: Option, ) -> Result<()> { let err_context = || format!("failed to add floating pane"); - if let Some(new_pane_geom) = self.floating_panes.find_room_for_new_pane() { + if let Some(mut new_pane_geom) = self.floating_panes.find_room_for_new_pane() { + if let Some(floating_pane_coordinates) = floating_pane_coordinates { + let viewport = self.viewport.borrow(); + new_pane_geom.adjust_coordinates(floating_pane_coordinates, *viewport); + self.swap_layouts.set_is_floating_damaged(); + } pane.set_active_at(Instant::now()); pane.set_geom(new_pane_geom); pane.set_content_offset(Offset::frame(1)); // floating panes always have a frame diff --git a/zellij-server/src/tab/unit/tab_integration_tests.rs b/zellij-server/src/tab/unit/tab_integration_tests.rs index 1ee1a7270..ef5cc1bf0 100644 --- a/zellij-server/src/tab/unit/tab_integration_tests.rs +++ b/zellij-server/src/tab/unit/tab_integration_tests.rs @@ -760,7 +760,7 @@ fn dump_screen() { ..Default::default() }); let new_pane_id = PaneId::Terminal(2); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes(2, Vec::from("scratch".as_bytes())) .unwrap(); @@ -788,7 +788,7 @@ fn clear_screen() { ..Default::default() }); let new_pane_id = PaneId::Terminal(2); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes(2, Vec::from("scratch".as_bytes())) .unwrap(); @@ -814,7 +814,7 @@ fn new_floating_pane() { let new_pane_id = PaneId::Terminal(2); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -842,7 +842,7 @@ fn floating_panes_persist_across_toggles() { let new_pane_id = PaneId::Terminal(2); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); // here we send bytes to the pane when it's not visible to make sure they're still handled and @@ -874,7 +874,7 @@ fn toggle_floating_panes_off() { let new_pane_id = PaneId::Terminal(2); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -903,7 +903,7 @@ fn toggle_floating_panes_on() { let new_pane_id = PaneId::Terminal(2); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -937,15 +937,15 @@ fn five_new_floating_panes() { let new_pane_id_5 = PaneId::Terminal(6); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_2, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_2, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_3, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_3, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_4, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_4, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_5, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_5, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -981,7 +981,7 @@ fn increase_floating_pane_size() { let new_pane_id_1 = PaneId::Terminal(2); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1011,7 +1011,7 @@ fn decrease_floating_pane_size() { let new_pane_id_1 = PaneId::Terminal(2); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1041,7 +1041,7 @@ fn resize_floating_pane_left() { let new_pane_id_1 = PaneId::Terminal(2); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1074,7 +1074,7 @@ fn resize_floating_pane_right() { let new_pane_id_1 = PaneId::Terminal(2); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1107,7 +1107,7 @@ fn resize_floating_pane_up() { let new_pane_id_1 = PaneId::Terminal(2); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1140,7 +1140,7 @@ fn resize_floating_pane_down() { let new_pane_id_1 = PaneId::Terminal(2); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1177,15 +1177,15 @@ fn move_floating_pane_focus_left() { let new_pane_id_5 = PaneId::Terminal(6); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_2, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_2, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_3, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_3, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_4, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_4, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_5, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_5, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1232,15 +1232,15 @@ fn move_floating_pane_focus_right() { let new_pane_id_5 = PaneId::Terminal(6); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_2, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_2, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_3, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_3, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_4, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_4, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_5, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_5, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1288,15 +1288,15 @@ fn move_floating_pane_focus_up() { let new_pane_id_5 = PaneId::Terminal(6); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_2, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_2, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_3, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_3, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_4, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_4, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_5, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_5, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1343,15 +1343,15 @@ fn move_floating_pane_focus_down() { let new_pane_id_5 = PaneId::Terminal(6); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_2, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_2, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_3, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_3, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_4, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_4, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_5, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_5, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1399,15 +1399,15 @@ fn move_floating_pane_focus_with_mouse() { let new_pane_id_5 = PaneId::Terminal(6); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_2, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_2, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_3, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_3, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_4, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_4, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_5, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_5, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1457,15 +1457,15 @@ fn move_pane_focus_with_mouse_to_non_floating_pane() { let new_pane_id_5 = PaneId::Terminal(6); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_2, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_2, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_3, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_3, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_4, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_4, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_5, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_5, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1515,15 +1515,15 @@ fn drag_pane_with_mouse() { let new_pane_id_5 = PaneId::Terminal(6); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_2, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_2, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_3, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_3, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_4, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_4, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_5, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_5, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1573,15 +1573,15 @@ fn mark_text_inside_floating_pane() { let new_pane_id_5 = PaneId::Terminal(6); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_2, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_2, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_3, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_3, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_4, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_4, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_5, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_5, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1639,15 +1639,15 @@ fn resize_tab_with_floating_panes() { let new_pane_id_5 = PaneId::Terminal(6); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_2, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_2, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_3, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_3, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_4, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_4, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_5, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_5, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1693,15 +1693,15 @@ fn shrink_whole_tab_with_floating_panes_horizontally_and_vertically() { let new_pane_id_5 = PaneId::Terminal(6); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_2, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_2, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_3, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_3, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_4, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_4, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_5, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_5, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1743,15 +1743,15 @@ fn shrink_whole_tab_with_floating_panes_horizontally_and_vertically_and_expand_b let new_pane_id_5 = PaneId::Terminal(6); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_2, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_2, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_3, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_3, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_4, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_4, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_5, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_5, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1794,7 +1794,7 @@ fn embed_floating_pane() { let new_pane_id = PaneId::Terminal(2); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1822,7 +1822,7 @@ fn float_embedded_pane() { let mut tab = create_new_tab(size, ModeInfo::default()); let new_pane_id = PaneId::Terminal(2); let mut output = Output::default(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1852,7 +1852,7 @@ fn embed_floating_pane_without_pane_frames() { let mut output = Output::default(); tab.set_pane_frames(false); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1881,7 +1881,7 @@ fn float_embedded_pane_without_pane_frames() { let new_pane_id = PaneId::Terminal(2); let mut output = Output::default(); tab.set_pane_frames(false); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -1984,7 +1984,7 @@ fn rename_floating_pane() { let mut tab = create_new_tab(size, ModeInfo::default()); let new_pane_id = PaneId::Terminal(2); let mut output = Output::default(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 2, @@ -2080,7 +2080,7 @@ fn move_floating_pane_with_sixel_image() { let mut output = Output::new(sixel_image_store.clone(), character_cell_size, true); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); let fixture = read_fixture("sixel-image-500px.six"); tab.handle_pty_bytes(2, fixture).unwrap(); @@ -2118,7 +2118,7 @@ fn floating_pane_above_sixel_image() { let mut output = Output::new(sixel_image_store.clone(), character_cell_size, true); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); let fixture = read_fixture("sixel-image-500px.six"); tab.handle_pty_bytes(1, fixture).unwrap(); @@ -2176,7 +2176,7 @@ fn suppress_floating_pane() { let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.replace_active_pane_with_editor_pane(editor_pane_id, client_id) .unwrap(); @@ -2232,7 +2232,7 @@ fn close_suppressing_floating_pane() { let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.replace_active_pane_with_editor_pane(editor_pane_id, client_id) .unwrap(); @@ -2292,7 +2292,7 @@ fn suppress_floating_pane_embed_it_and_close_it() { let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.replace_active_pane_with_editor_pane(editor_pane_id, client_id) .unwrap(); @@ -2354,7 +2354,7 @@ fn resize_whole_tab_while_floting_pane_is_suppressed() { let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); tab.replace_active_pane_with_editor_pane(editor_pane_id, client_id) .unwrap(); @@ -2456,7 +2456,7 @@ fn enter_search_floating_pane() { let new_pane_id = PaneId::Terminal(2); let mut output = Output::default(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id, None, None, None, None, Some(client_id)) .unwrap(); let pane_content = read_fixture("grid_copy"); @@ -2961,7 +2961,7 @@ fn move_pane_focus_sends_tty_csi_event() { }); let mut tab = create_new_tab_with_os_api(size, ModeInfo::default(), &os_api); let new_pane_id_1 = PaneId::Terminal(2); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 1, @@ -2996,9 +2996,9 @@ fn move_floating_pane_focus_sends_tty_csi_event() { let new_pane_id_2 = PaneId::Terminal(3); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_2, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_2, None, None, None, None, Some(client_id)) .unwrap(); tab.handle_pty_bytes( 1, @@ -3039,9 +3039,9 @@ fn toggle_floating_panes_on_sends_tty_csi_event() { let new_pane_id_2 = PaneId::Terminal(3); tab.toggle_floating_panes(Some(client_id), None).unwrap(); - tab.new_pane(new_pane_id_1, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_1, None, None, None, None, Some(client_id)) .unwrap(); - tab.new_pane(new_pane_id_2, None, None, None, Some(client_id)) + tab.new_pane(new_pane_id_2, None, None, None, None, Some(client_id)) .unwrap(); tab.toggle_floating_panes(Some(client_id), None).unwrap(); tab.handle_pty_bytes( @@ -3083,9 +3083,9 @@ fn toggle_floating_panes_off_sends_tty_csi_event() { let new_pane_id_2 = PaneId