diff options
author | Aram Drevekenin <aram@poor.dev> | 2023-10-17 11:55:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-17 11:55:38 +0200 |
commit | 69eb904426e64649fc7228b0d6803469911267d7 (patch) | |
tree | a4c1448de8301f91856917dfcbe3c0f13d0e25ae /zellij-server/src/os_input_output.rs | |
parent | 8378f146c124e40ceed1f63628b9254bafe19c2f (diff) |
feat(panes): Add an option to press <ESC> and drop to shell in command panes (#2872)
* feat(panes): ESC to drop to default shell on command panes
* style(fmt): rustfmt
Diffstat (limited to 'zellij-server/src/os_input_output.rs')
-rw-r--r-- | zellij-server/src/os_input_output.rs | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/zellij-server/src/os_input_output.rs b/zellij-server/src/os_input_output.rs index 46a0d9974..793e5b665 100644 --- a/zellij-server/src/os_input_output.rs +++ b/zellij-server/src/os_input_output.rs @@ -31,7 +31,7 @@ use zellij_utils::{ }; use std::{ - collections::{BTreeMap, HashMap, HashSet}, + collections::{BTreeMap, BTreeSet, HashMap}, env, fs::File, io::Write, @@ -581,7 +581,7 @@ impl ServerOsApi for ServerOsInputOutput { .with_context(err_context)?; let mut terminal_id = None; { - let current_ids: HashSet<u32> = self + let current_ids: BTreeSet<u32> = self .terminal_id_to_raw_fd .lock() .to_anyhow() @@ -589,13 +589,7 @@ impl ServerOsApi for ServerOsInputOutput { .keys() .copied() .collect(); - for i in 0..u32::MAX { - let i = i as u32; - if !current_ids.contains(&i) { - terminal_id = Some(i); - break; - } - } + terminal_id = current_ids.last().map(|l| l + 1).or(Some(0)); } match terminal_id { Some(terminal_id) => { @@ -628,7 +622,7 @@ impl ServerOsApi for ServerOsInputOutput { let mut terminal_id = None; { - let current_ids: HashSet<u32> = self + let current_ids: BTreeSet<u32> = self .terminal_id_to_raw_fd .lock() .to_anyhow() @@ -636,13 +630,7 @@ impl ServerOsApi for ServerOsInputOutput { .keys() .copied() .collect(); - for i in 0..u32::MAX { - let i = i as u32; - if !current_ids.contains(&i) { - terminal_id = Some(i); - break; - } - } + terminal_id = current_ids.last().map(|l| l + 1).or(Some(0)); } match terminal_id { Some(terminal_id) => { |