diff options
-rw-r--r-- | default-plugins/session-manager/src/main.rs | 8 | ||||
-rw-r--r-- | default-plugins/session-manager/src/session_list.rs | 8 | ||||
-rw-r--r-- | zellij-server/src/panes/floating_panes/mod.rs | 5 | ||||
-rw-r--r-- | zellij-server/src/panes/plugin_pane.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/plugins/zellij_exports.rs | 1 |
5 files changed, 16 insertions, 8 deletions
diff --git a/default-plugins/session-manager/src/main.rs b/default-plugins/session-manager/src/main.rs index 66ff54c4f..b65986319 100644 --- a/default-plugins/session-manager/src/main.rs +++ b/default-plugins/session-manager/src/main.rs @@ -15,7 +15,6 @@ use session_list::SessionList; struct State { session_name: Option<String>, sessions: SessionList, - selected_index: Option<usize>, search_term: String, new_session_name: Option<String>, colors: Colors, @@ -79,7 +78,7 @@ impl ZellijPlugin for State { impl State { fn reset_selected_index(&mut self) { - self.selected_index = None; + self.sessions.reset_selected_index(); } fn handle_key(&mut self, key: Key) -> bool { let mut should_render = false; @@ -186,6 +185,11 @@ impl State { switch_session_with_focus(&selected_session_name, selected_tab, selected_pane); } } + self.reset_selected_index(); + self.new_session_name = None; + self.search_term.clear(); + self.sessions + .update_search_term(&self.search_term, &self.colors); hide_self(); } fn update_session_infos(&mut self, session_infos: Vec<SessionInfo>) { diff --git a/default-plugins/session-manager/src/session_list.rs b/default-plugins/session-manager/src/session_list.rs index 6cf6f7163..788d324f7 100644 --- a/default-plugins/session-manager/src/session_list.rs +++ b/default-plugins/session-manager/src/session_list.rs @@ -311,6 +311,9 @@ impl SessionList { } } } + pub fn reset_selected_index(&mut self) { + self.selected_index.reset(); + } } #[derive(Debug, Clone, Default)] @@ -339,6 +342,11 @@ impl SelectedIndex { _ => {}, } } + pub fn reset(&mut self) { + self.0 = None; + self.1 = None; + self.2 = None; + } } #[derive(Debug)] diff --git a/zellij-server/src/panes/floating_panes/mod.rs b/zellij-server/src/panes/floating_panes/mod.rs index 626ec811d..1f2d770bb 100644 --- a/zellij-server/src/panes/floating_panes/mod.rs +++ b/zellij-server/src/panes/floating_panes/mod.rs @@ -872,11 +872,6 @@ impl FloatingPanes { } pub fn get_plugin_pane_id(&self, run_plugin: &RunPlugin) -> Option<PaneId> { let run = Some(Run::Plugin(run_plugin.clone())); - let currently_running_invoked_with: Vec<Option<Run>> = self - .panes - .iter() - .map(|(_, p)| p.invoked_with().clone()) - .collect(); self.panes .iter() .find(|(_id, s_p)| s_p.invoked_with() == &run) diff --git a/zellij-server/src/panes/plugin_pane.rs b/zellij-server/src/panes/plugin_pane.rs index b4e3461e2..8cf428995 100644 --- a/zellij-server/src/panes/plugin_pane.rs +++ b/zellij-server/src/panes/plugin_pane.rs @@ -674,7 +674,7 @@ impl PluginPane { )); } else { messages.push_str(&format!( - "{} {}. {} {}\n", + "{} {}. {} {}", bold_white.paint("This plugin asks permission to:"), orange.paint( permissions diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs index c00d1ea50..6ec50c3a5 100644 --- a/zellij-server/src/plugins/zellij_exports.rs +++ b/zellij-server/src/plugins/zellij_exports.rs @@ -1143,6 +1143,7 @@ fn check_command_permission( | PluginCommand::FocusPluginPane(..) | PluginCommand::RenameTerminalPane(..) | PluginCommand::RenamePluginPane(..) + | PluginCommand::SwitchSession(..) | PluginCommand::RenameTab(..) => PermissionType::ChangeApplicationState, _ => return (PermissionStatus::Granted, None), }; |