Improve: more explicit detach instruction (#1161)
* feat: update detach and remove client * chore: apply clippy warning * fix(tests): update snapshot
This commit is contained in:
parent
c5eea7bd91
commit
5a56aa0603
4 changed files with 9 additions and 22 deletions
|
|
@ -5,7 +5,7 @@ expression: last_snapshot
|
|||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
┌ Pane #1 ─────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
|
||||
│$ █ ││$ I am some text │
|
||||
│$ ││$ I am some text█ │
|
||||
│ ││ │
|
||||
│ ││ │
|
||||
│ ││ │
|
||||
|
|
|
|||
|
|
@ -477,22 +477,6 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
|||
.send_to_screen(ScreenInstruction::TerminalResize(min_size))
|
||||
.unwrap();
|
||||
}
|
||||
session_data
|
||||
.write()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.senders
|
||||
.send_to_screen(ScreenInstruction::RemoveClient(client_id))
|
||||
.unwrap();
|
||||
session_data
|
||||
.write()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.senders
|
||||
.send_to_plugin(PluginInstruction::RemoveClient(client_id))
|
||||
.unwrap();
|
||||
}
|
||||
ServerInstruction::Render(serialized_output) => {
|
||||
let client_ids = session_state.read().unwrap().client_ids();
|
||||
|
|
|
|||
|
|
@ -566,12 +566,14 @@ impl Screen {
|
|||
.add_client(client_id, None);
|
||||
}
|
||||
pub fn remove_client(&mut self, client_id: ClientId) {
|
||||
if let Some(client_tab) = self.get_active_tab_mut(client_id) {
|
||||
client_tab.remove_client(client_id);
|
||||
if client_tab.has_no_connected_clients() {
|
||||
client_tab.visible(false);
|
||||
self.tabs.iter_mut().for_each(|(_, tab)| {
|
||||
if tab.active_panes.get(&client_id).is_some() {
|
||||
tab.remove_client(client_id);
|
||||
if tab.has_no_connected_clients() {
|
||||
tab.visible(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
if self.active_tab_indices.contains_key(&client_id) {
|
||||
self.active_tab_indices.remove(&client_id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -578,6 +578,7 @@ impl Tab {
|
|||
}
|
||||
pub fn remove_client(&mut self, client_id: ClientId) {
|
||||
self.focus_pane_id = None;
|
||||
self.active_panes.remove(&client_id);
|
||||
self.connected_clients.remove(&client_id);
|
||||
self.set_force_render();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue