diff options
author | Aram Drevekenin <aram@poor.dev> | 2023-08-26 11:06:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-26 11:06:22 +0200 |
commit | 2dbee21d74e1822d7f852d868cb1956525cb8a22 (patch) | |
tree | 0f158ae0c6420d339f7dceede5f14d0c57d6f98d /default-plugins | |
parent | a819e9bf54e89be92f72b7f31cb0857a29b27d39 (diff) |
fix(plugins): various ui fixes (#2731)
Diffstat (limited to 'default-plugins')
-rw-r--r-- | default-plugins/session-manager/src/main.rs | 8 | ||||
-rw-r--r-- | default-plugins/session-manager/src/session_list.rs | 8 |
2 files changed, 14 insertions, 2 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)] |