diff --git a/default-plugins/fixture-plugin-for-tests/src/main.rs b/default-plugins/fixture-plugin-for-tests/src/main.rs index 7e0da52bd7..9293534669 100644 --- a/default-plugins/fixture-plugin-for-tests/src/main.rs +++ b/default-plugins/fixture-plugin-for-tests/src/main.rs @@ -417,11 +417,19 @@ impl ZellijPlugin for State { }, BareKey::Char('u') if key.has_modifiers(&[KeyModifier::Alt]) => { let should_change_focus_to_new_tab = true; - break_panes_to_new_tab(&[PaneId::Terminal(1), PaneId::Plugin(2)], Some("new_tab_name".to_owned()), should_change_focus_to_new_tab); + break_panes_to_new_tab( + &[PaneId::Terminal(1), PaneId::Plugin(2)], + Some("new_tab_name".to_owned()), + should_change_focus_to_new_tab, + ); }, BareKey::Char('v') if key.has_modifiers(&[KeyModifier::Alt]) => { let should_change_focus_to_target_tab = true; - break_panes_to_tab_with_index(&[PaneId::Terminal(1), PaneId::Plugin(2)], 2, should_change_focus_to_target_tab); + break_panes_to_tab_with_index( + &[PaneId::Terminal(1), PaneId::Plugin(2)], + 2, + should_change_focus_to_target_tab, + ); }, _ => {}, }, diff --git a/zellij-server/src/plugins/mod.rs b/zellij-server/src/plugins/mod.rs index 1ad64ba9bd..9f7ef13a40 100644 --- a/zellij-server/src/plugins/mod.rs +++ b/zellij-server/src/plugins/mod.rs @@ -74,7 +74,7 @@ pub enum PluginInstruction { Option, Vec, usize, // tab_index - bool, // should change focus to new tab + bool, // should change focus to new tab ClientId, ), ApplyCachedEvents { diff --git a/zellij-server/src/plugins/unit/plugin_tests.rs b/zellij-server/src/plugins/unit/plugin_tests.rs index 32f7548679..0d20cea0a2 100644 --- a/zellij-server/src/plugins/unit/plugin_tests.rs +++ b/zellij-server/src/plugins/unit/plugin_tests.rs @@ -253,7 +253,7 @@ macro_rules! grant_permissions_and_log_actions_in_thread_struct_variant { .recv() .expect("failed to receive event on channel"); match event { - $exit_event { .. }=> { + $exit_event { .. } => { exit_event_count += 1; log.lock().unwrap().push(event); if exit_event_count == $exit_after_count { @@ -8236,7 +8236,7 @@ pub fn break_panes_to_new_tab_plugin_command() { .unwrap() .iter() .find_map(|i| { - if let ScreenInstruction::BreakPanesToNewTab{..} = i { + if let ScreenInstruction::BreakPanesToNewTab { .. } = i { Some(i.clone()) } else { None @@ -8307,7 +8307,7 @@ pub fn break_panes_to_tab_with_index_plugin_command() { .unwrap() .iter() .find_map(|i| { - if let ScreenInstruction::BreakPanesToTabWithIndex{..} = i { + if let ScreenInstruction::BreakPanesToTabWithIndex { .. } = i { Some(i.clone()) } else { None diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs index 75590c385a..6bdabaa302 100644 --- a/zellij-server/src/plugins/zellij_exports.rs +++ b/zellij-server/src/plugins/zellij_exports.rs @@ -320,12 +320,26 @@ fn host_run_plugin_command(caller: Caller<'_, PluginEnv>) { PluginCommand::CloseTabWithIndex(tab_index) => { close_tab_with_index(env, tab_index) }, - PluginCommand::BreakPanesToNewTab(pane_ids, new_tab_name, should_change_focus_to_new_tab) => { - break_panes_to_new_tab(env, pane_ids.into_iter().map(|p_id| p_id.into()).collect(), new_tab_name, should_change_focus_to_new_tab) - }, - PluginCommand::BreakPanesToTabWithIndex(pane_ids, should_change_focus_to_new_tab, tab_index) => { - break_panes_to_tab_with_index(env, pane_ids.into_iter().map(|p_id| p_id.into()).collect(), tab_index, should_change_focus_to_new_tab) - }, + PluginCommand::BreakPanesToNewTab( + pane_ids, + new_tab_name, + should_change_focus_to_new_tab, + ) => break_panes_to_new_tab( + env, + pane_ids.into_iter().map(|p_id| p_id.into()).collect(), + new_tab_name, + should_change_focus_to_new_tab, + ), + PluginCommand::BreakPanesToTabWithIndex( + pane_ids, + should_change_focus_to_new_tab, + tab_index, + ) => break_panes_to_tab_with_index( + env, + pane_ids.into_iter().map(|p_id| p_id.into()).collect(), + tab_index, + should_change_focus_to_new_tab, + ), }, (PermissionStatus::Denied, permission) => { log::error!( @@ -1595,7 +1609,12 @@ fn close_tab_with_index(env: &PluginEnv, tab_index: usize) { .send_to_screen(ScreenInstruction::CloseTabWithIndex(tab_index)); } -fn break_panes_to_new_tab(env: &PluginEnv, pane_ids: Vec, new_tab_name: Option, should_change_focus_to_new_tab: bool) { +fn break_panes_to_new_tab( + env: &PluginEnv, + pane_ids: Vec, + new_tab_name: Option, + should_change_focus_to_new_tab: bool, +) { let default_shell = env.default_shell.clone().or_else(|| { Some(TerminalAction::RunCommand(RunCommand { command: env.path_to_default_shell.clone(), @@ -1604,13 +1623,29 @@ fn break_panes_to_new_tab(env: &PluginEnv, pane_ids: Vec, new_tab_name: }); let _ = env .senders - .send_to_screen(ScreenInstruction::BreakPanesToNewTab{pane_ids, default_shell, new_tab_name, should_change_focus_to_new_tab, client_id: env.client_id}); + .send_to_screen(ScreenInstruction::BreakPanesToNewTab { + pane_ids, + default_shell, + new_tab_name, + should_change_focus_to_new_tab, + client_id: env.client_id, + }); } -fn break_panes_to_tab_with_index(env: &PluginEnv, pane_ids: Vec, should_change_focus_to_new_tab: bool, tab_index: usize) { +fn break_panes_to_tab_with_index( + env: &PluginEnv, + pane_ids: Vec, + should_change_focus_to_new_tab: bool, + tab_index: usize, +) { let _ = env .senders - .send_to_screen(ScreenInstruction::BreakPanesToTabWithIndex{pane_ids, tab_index, client_id: env.client_id, should_change_focus_to_new_tab}); + .send_to_screen(ScreenInstruction::BreakPanesToTabWithIndex { + pane_ids, + tab_index, + client_id: env.client_id, + should_change_focus_to_new_tab, + }); } // Custom panic handler for plugins. diff --git a/zellij-server/src/pty.rs b/zellij-server/src/pty.rs index 5906dbfbca..92270943f6 100644 --- a/zellij-server/src/pty.rs +++ b/zellij-server/src/pty.rs @@ -64,7 +64,7 @@ pub enum PtyInstruction { Vec, usize, // tab_index HashMap>, // plugin_ids - bool, // should change focus to new tab + bool, // should change focus to new tab ClientId, ), // the String is the tab name ClosePane(PaneId), diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index 093388c84c..cebe5b2688 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -227,7 +227,7 @@ pub enum ScreenInstruction { Vec<(u32, HoldForCommand)>, // new floating pane pids HashMap>, usize, // tab_index - bool, // should change focus to new tab + bool, // should change focus to new tab ClientId, ), SwitchTabNext(ClientId), @@ -396,12 +396,12 @@ pub enum ScreenInstruction { TogglePaneIdFullscreen(PaneId), TogglePaneEmbedOrEjectForPaneId(PaneId), CloseTabWithIndex(usize), - BreakPanesToNewTab{ - pane_ids: Vec, + BreakPanesToNewTab { + pane_ids: Vec, default_shell: Option, should_change_focus_to_new_tab: bool, new_tab_name: Option, - client_id: ClientId + client_id: ClientId, }, BreakPanesToTabWithIndex { pane_ids: Vec, @@ -616,8 +616,10 @@ impl From<&ScreenInstruction> for ScreenContext { ScreenContext::TogglePaneEmbedOrEjectForPaneId }, ScreenInstruction::CloseTabWithIndex(..) => ScreenContext::CloseTabWithIndex, - ScreenInstruction::BreakPanesToNewTab{..} => ScreenContext::BreakPanesToNewTab, - ScreenInstruction::BreakPanesToTabWithIndex{..} => ScreenContext::BreakPanesToTabWithIndex, + ScreenInstruction::BreakPanesToNewTab { .. } => ScreenContext::BreakPanesToNewTab, + ScreenInstruction::BreakPanesToTabWithIndex { .. } => { + ScreenContext::BreakPanesToTabWithIndex + }, } } } @@ -1186,7 +1188,9 @@ impl Screen { } for tab_index in tabs_to_close { // cleanup as needed - self.close_tab_at_index(tab_index).context(err_context).non_fatal(); + self.close_tab_at_index(tab_index) + .context(err_context) + .non_fatal(); } if output.is_dirty() { let serialized_output = output.serialize().context(err_context)?; @@ -1275,12 +1279,14 @@ impl Screen { ) -> Result<()> { let err_context = || format!("failed to create new tab for client {client_id:?}",); - let client_id = client_id.map(|client_id| if self.get_active_tab(client_id).is_ok() { - client_id - } else if let Some(first_client_id) = self.get_first_client_id() { - first_client_id - } else { - client_id + let client_id = client_id.map(|client_id| { + if self.get_active_tab(client_id).is_ok() { + client_id + } else if let Some(first_client_id) = self.get_first_client_id() { + first_client_id + } else { + client_id + } }); let tab_name = tab_name.unwrap_or_else(|| String::new()); @@ -1352,16 +1358,20 @@ impl Screen { // move the relevant clients out of the current tab and place them in the new one let drained_clients = if should_change_client_focus { if self.session_is_mirrored { - let client_mode_infos_in_source_tab = - if let Ok(active_tab) = self.get_active_tab_mut(client_id) { - let client_mode_infos_in_source_tab = active_tab.drain_connected_clients(None); - if active_tab.has_no_connected_clients() { - active_tab.visible(false).with_context(err_context).non_fatal(); - } - Some(client_mode_infos_in_source_tab) - } else { - None - }; + let client_mode_infos_in_source_tab = if let Ok(active_tab) = + self.get_active_tab_mut(client_id) + { + let client_mode_infos_in_source_tab = active_tab.drain_connected_clients(None); + if active_tab.has_no_connected_clients() { + active_tab + .visible(false) + .with_context(err_context) + .non_fatal(); + } + Some(client_mode_infos_in_source_tab) + } else { + None + }; let all_connected_clients: Vec = self.connected_clients.borrow().iter().copied().collect(); for client_id in all_connected_clients { @@ -1372,7 +1382,10 @@ impl Screen { let client_mode_info_in_source_tab = active_tab.drain_connected_clients(Some(vec![client_id])); if active_tab.has_no_connected_clients() { - active_tab.visible(false).with_context(err_context).non_fatal(); + active_tab + .visible(false) + .with_context(err_context) + .non_fatal(); } self.update_client_tab_focus(client_id, tab_index); Some(client_mode_info_in_source_tab) @@ -1388,7 +1401,6 @@ impl Screen { .get_mut(&tab_index) .context("couldn't find tab with index {tab_index}") .and_then(|tab| { - tab.apply_layout( layout, floating_panes_layout, @@ -1403,8 +1415,7 @@ impl Screen { tab.visible(true)?; tab.add_multiple_clients(drained_clients)?; } - tab.resize_whole_tab(self.size) - .with_context(err_context)?; + tab.resize_whole_tab(self.size).with_context(err_context)?; tab.set_force_render(); Ok(()) }) @@ -2174,10 +2185,7 @@ impl Screen { } } - let ( - mut tiled_panes_layout, - floating_panes_layout - ) = self.default_layout.new_tab(); + let (mut tiled_panes_layout, floating_panes_layout) = self.default_layout.new_tab(); let tab_index = self.get_new_tab_index(); let swap_layouts = ( self.default_layout.swap_tiled_layouts.clone(), @@ -2281,7 +2289,10 @@ impl Screen { client_id: ClientId, ) -> Result<()> { let all_tabs = self.get_tabs_mut(); - let has_tab_with_index = all_tabs.values().find(|t| t.position == tab_index).is_some(); + let has_tab_with_index = all_tabs + .values() + .find(|t| t.position == tab_index) + .is_some(); if !has_tab_with_index { log::error!("Cannot find tab with index: {tab_index}"); return Ok(()); @@ -3505,7 +3516,12 @@ pub(crate) fn screen_thread_main( if create && !tab_exists { let tab_index = screen.get_new_tab_index(); let should_change_focus_to_new_tab = true; - screen.new_tab(tab_index, swap_layouts, Some(tab_name), Some(client_id))?; + screen.new_tab( + tab_index, + swap_layouts, + Some(tab_name), + Some(client_id), + )?; screen .bus .senders @@ -4570,11 +4586,33 @@ pub(crate) fn screen_thread_main( ScreenInstruction::CloseTabWithIndex(tab_index) => { screen.close_tab_at_index(tab_index).non_fatal() }, - ScreenInstruction::BreakPanesToNewTab{pane_ids, default_shell, should_change_focus_to_new_tab, new_tab_name, client_id} => { - screen.break_multiple_panes_to_new_tab(pane_ids, default_shell, should_change_focus_to_new_tab, new_tab_name, client_id)?; + ScreenInstruction::BreakPanesToNewTab { + pane_ids, + default_shell, + should_change_focus_to_new_tab, + new_tab_name, + client_id, + } => { + screen.break_multiple_panes_to_new_tab( + pane_ids, + default_shell, + should_change_focus_to_new_tab, + new_tab_name, + client_id, + )?; }, - ScreenInstruction::BreakPanesToTabWithIndex{pane_ids, tab_index, should_change_focus_to_new_tab, client_id} => { - screen.break_multiple_panes_to_tab_with_index(pane_ids, tab_index, should_change_focus_to_new_tab, client_id)?; + ScreenInstruction::BreakPanesToTabWithIndex { + pane_ids, + tab_index, + should_change_focus_to_new_tab, + client_id, + } => { + screen.break_multiple_panes_to_tab_with_index( + pane_ids, + tab_index, + should_change_focus_to_new_tab, + client_id, + )?; }, } } diff --git a/zellij-server/src/tab/layout_applier.rs b/zellij-server/src/tab/layout_applier.rs index bf7e4e1e36..2cc2b7f823 100644 --- a/zellij-server/src/tab/layout_applier.rs +++ b/zellij-server/src/tab/layout_applier.rs @@ -256,9 +256,12 @@ impl<'a> LayoutApplier<'a> { position_and_size, layout.borderless, ); - } else if let Some(position) = positions_in_layout - .iter() - .position(|(layout, _position_and_size)| Run::is_terminal(&layout.run) && Run::is_terminal(&run_instruction)) + } else if let Some(position) = + positions_in_layout + .iter() + .position(|(layout, _position_and_size)| { + Run::is_terminal(&layout.run) && Run::is_terminal(&run_instruction) + }) { let (layout, position_and_size) = positions_in_layout.remove(position); self.tiled_panes.set_geom_for_pane_with_run( diff --git a/zellij-tile/src/shim.rs b/zellij-tile/src/shim.rs index 57d6f86070..268e10f26c 100644 --- a/zellij-tile/src/shim.rs +++ b/zellij-tile/src/shim.rs @@ -1031,16 +1031,32 @@ where } /// Create a new tab that includes the specified pane ids -pub fn break_panes_to_new_tab(pane_ids: &[PaneId], new_tab_name: Option, should_change_focus_to_new_tab: bool) { - let plugin_command = PluginCommand::BreakPanesToNewTab(pane_ids.to_vec(), new_tab_name, should_change_focus_to_new_tab); +pub fn break_panes_to_new_tab( + pane_ids: &[PaneId], + new_tab_name: Option, + should_change_focus_to_new_tab: bool, +) { + let plugin_command = PluginCommand::BreakPanesToNewTab( + pane_ids.to_vec(), + new_tab_name, + should_change_focus_to_new_tab, + ); let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); object_to_stdout(&protobuf_plugin_command.encode_to_vec()); unsafe { host_run_plugin_command() }; } /// Create a new tab that includes the specified pane ids -pub fn break_panes_to_tab_with_index(pane_ids: &[PaneId], tab_index: usize, should_change_focus_to_new_tab: bool) { - let plugin_command = PluginCommand::BreakPanesToTabWithIndex(pane_ids.to_vec(), tab_index, should_change_focus_to_new_tab); +pub fn break_panes_to_tab_with_index( + pane_ids: &[PaneId], + tab_index: usize, + should_change_focus_to_new_tab: bool, +) { + let plugin_command = PluginCommand::BreakPanesToTabWithIndex( + pane_ids.to_vec(), + tab_index, + should_change_focus_to_new_tab, + ); let protobuf_plugin_command: ProtobufPluginCommand = plugin_command.try_into().unwrap(); object_to_stdout(&protobuf_plugin_command.encode_to_vec()); unsafe { host_run_plugin_command() }; diff --git a/zellij-utils/src/data.rs b/zellij-utils/src/data.rs index c33e0c8535..eb7179454d 100644 --- a/zellij-utils/src/data.rs +++ b/zellij-utils/src/data.rs @@ -1837,9 +1837,9 @@ pub enum PluginCommand { TogglePaneEmbedOrEjectForPaneId(PaneId), CloseTabWithIndex(usize), // usize - tab_index BreakPanesToNewTab(Vec, Option, bool), // bool - - // should_change_focus_to_new_tab, - // Option - optional name for - // the new tab + // should_change_focus_to_new_tab, + // Option - optional name for + // the new tab BreakPanesToTabWithIndex(Vec, usize, bool), // usize - tab_index, bool - // should_change_focus_to_new_tab } diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs index f853ebed21..dbcd4181de 100644 --- a/zellij-utils/src/input/layout.rs +++ b/zellij-utils/src/input/layout.rs @@ -945,7 +945,7 @@ impl TiledPaneLayout { // from a global layout cwd and the pane is actually just a bare pane that // wants to be overidden) Some(Run::Cwd(_)) | None => true, - _ => false + _ => false, } }) { run_instructions.remove(position); diff --git a/zellij-utils/src/plugin_api/plugin_command.rs b/zellij-utils/src/plugin_api/plugin_command.rs index 478e0002a8..15c56d03da 100644 --- a/zellij-utils/src/plugin_api/plugin_command.rs +++ b/zellij-utils/src/plugin_api/plugin_command.rs @@ -3,9 +3,10 @@ pub use super::generated_api::api::{ event::{EventNameList as ProtobufEventNameList, Header}, input_mode::InputMode as ProtobufInputMode, plugin_command::{ - plugin_command::Payload, ClearScreenForPaneIdPayload, CliPipeOutputPayload, - CloseTabWithIndexPayload, CommandName, ContextItem, EditScrollbackForPaneWithIdPayload, - EnvVariable, ExecCmdPayload, FixedOrPercent as ProtobufFixedOrPercent, + plugin_command::Payload, BreakPanesToNewTabPayload, BreakPanesToTabWithIndexPayload, + ClearScreenForPaneIdPayload, CliPipeOutputPayload, CloseTabWithIndexPayload, CommandName, + ContextItem, EditScrollbackForPaneWithIdPayload, EnvVariable, ExecCmdPayload, + FixedOrPercent as ProtobufFixedOrPercent, FixedOrPercentValue as ProtobufFixedOrPercentValue, FloatingPaneCoordinates as ProtobufFloatingPaneCoordinates, HidePaneWithIdPayload, HttpVerb as ProtobufHttpVerb, IdAndNewName, KillSessionsPayload, MessageToPluginPayload, @@ -19,7 +20,7 @@ pub use super::generated_api::api::{ ScrollToTopInPaneIdPayload, ScrollUpInPaneIdPayload, SetTimeoutPayload, ShowPaneWithIdPayload, SubscribePayload, SwitchSessionPayload, SwitchTabToPayload, TogglePaneEmbedOrEjectForPaneIdPayload, TogglePaneIdFullscreenPayload, UnsubscribePayload, - WebRequestPayload, WriteCharsToPaneIdPayload, WriteToPaneIdPayload, BreakPanesToNewTabPayload, BreakPanesToTabWithIndexPayload + WebRequestPayload, WriteCharsToPaneIdPayload, WriteToPaneIdPayload, }, plugin_permission::PermissionType as ProtobufPermissionType, resize::ResizeAction as ProtobufResizeAction, @@ -1175,23 +1176,31 @@ impl TryFrom for PluginCommand { _ => Err("Mismatched payload for CloseTabWithIndex"), }, Some(CommandName::BreakPanesToNewTab) => match protobuf_plugin_command.payload { - Some(Payload::BreakPanesToNewTabPayload(break_panes_to_new_tab_payload)) => Ok( - PluginCommand::BreakPanesToNewTab( - break_panes_to_new_tab_payload.pane_ids.into_iter().filter_map(|p_id| p_id.try_into().ok()).collect(), + Some(Payload::BreakPanesToNewTabPayload(break_panes_to_new_tab_payload)) => { + Ok(PluginCommand::BreakPanesToNewTab( + break_panes_to_new_tab_payload + .pane_ids + .into_iter() + .filter_map(|p_id| p_id.try_into().ok()) + .collect(), break_panes_to_new_tab_payload.new_tab_name, break_panes_to_new_tab_payload.should_change_focus_to_new_tab, - ), - ), + )) + }, _ => Err("Mismatched payload for BreakPanesToNewTab"), }, Some(CommandName::BreakPanesToTabWithIndex) => match protobuf_plugin_command.payload { - Some(Payload::BreakPanesToTabWithIndexPayload(break_panes_to_tab_with_index_payload)) => Ok( - PluginCommand::BreakPanesToTabWithIndex( - break_panes_to_tab_with_index_payload.pane_ids.into_iter().filter_map(|p_id| p_id.try_into().ok()).collect(), - break_panes_to_tab_with_index_payload.tab_index as usize, - break_panes_to_tab_with_index_payload.should_change_focus_to_target_tab, - ), - ), + Some(Payload::BreakPanesToTabWithIndexPayload( + break_panes_to_tab_with_index_payload, + )) => Ok(PluginCommand::BreakPanesToTabWithIndex( + break_panes_to_tab_with_index_payload + .pane_ids + .into_iter() + .filter_map(|p_id| p_id.try_into().ok()) + .collect(), + break_panes_to_tab_with_index_payload.tab_index as usize, + break_panes_to_tab_with_index_payload.should_change_focus_to_target_tab, + )), _ => Err("Mismatched payload for BreakPanesToTabWithIndex"), }, None => Err("Unrecognized plugin command"), @@ -1942,21 +1951,35 @@ impl TryFrom for ProtobufPluginCommand { }, )), }), - PluginCommand::BreakPanesToNewTab(pane_ids, new_tab_name, should_change_focus_to_new_tab) => Ok(ProtobufPluginCommand { + PluginCommand::BreakPanesToNewTab( + pane_ids, + new_tab_name, + should_change_focus_to_new_tab, + ) => Ok(ProtobufPluginCommand { name: CommandName::BreakPanesToNewTab as i32, payload: Some(Payload::BreakPanesToNewTabPayload( BreakPanesToNewTabPayload { - pane_ids: pane_ids.into_iter().filter_map(|p_id| p_id.try_into().ok()).collect(), + pane_ids: pane_ids + .into_iter() + .filter_map(|p_id| p_id.try_into().ok()) + .collect(), should_change_focus_to_new_tab, new_tab_name, }, )), }), - PluginCommand::BreakPanesToTabWithIndex(pane_ids, tab_index, should_change_focus_to_target_tab) => Ok(ProtobufPluginCommand { + PluginCommand::BreakPanesToTabWithIndex( + pane_ids, + tab_index, + should_change_focus_to_target_tab, + ) => Ok(ProtobufPluginCommand { name: CommandName::BreakPanesToTabWithIndex as i32, payload: Some(Payload::BreakPanesToTabWithIndexPayload( BreakPanesToTabWithIndexPayload { - pane_ids: pane_ids.into_iter().filter_map(|p_id| p_id.try_into().ok()).collect(), + pane_ids: pane_ids + .into_iter() + .filter_map(|p_id| p_id.try_into().ok()) + .collect(), tab_index: tab_index as u32, should_change_focus_to_target_tab, },