diff options
author | Aram Drevekenin <aram@poor.dev> | 2023-03-31 17:50:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-31 17:50:21 +0200 |
commit | 88da3be23a9d7263ad58030e66d08760a78d76f8 (patch) | |
tree | 1bc561e871f65f2e2718874717aefee036761c54 /zellij-server | |
parent | 04c6af182e26a6050cb854aa7e340b261b531201 (diff) |
fix(layouts): focus tab race (#2340)
Diffstat (limited to 'zellij-server')
-rw-r--r-- | zellij-server/src/screen.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index 10f9f3451..380b124be 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -2157,12 +2157,17 @@ pub(crate) fn screen_thread_main( screen.active_tab_indices.keys().next().copied() }; match client_id_to_switch { - Some(client_id) => { + // we must make sure pending_tab_ids is empty because otherwise we cannot be + // sure this instruction is applied at the right time (eg. we might have a + // pending tab that will become not-pending after this instruction and change + // the client focus, which should have happened before this instruction and not + // after) + Some(client_id) if pending_tab_ids.is_empty() => { screen.go_to_tab(tab_index as usize, client_id)?; screen.unblock_input()?; screen.render()?; }, - None => { + _ => { if let Some(client_id) = client_id { pending_tab_switches.insert((tab_index as usize, client_id)); } |