aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-server
diff options
context:
space:
mode:
authorXOR-op <17672363+XOR-op@users.noreply.github.com>2026-01-27 04:27:38 -0500
committerGitHub <noreply@github.com>2026-01-27 10:27:38 +0100
commitca98d8707fe01ca30958c3d31370ffe0dfc4506c (patch)
treefbf0d17840eb641fb2e9581309a82deeb9f03fe3 /zellij-server
parentfix: properly occlude cursor in floating pane when pinned pane covers it (#4644) (diff)
downloadsl0ppij-ca98d8707fe01ca30958c3d31370ffe0dfc4506c.tar.gz
sl0ppij-ca98d8707fe01ca30958c3d31370ffe0dfc4506c.tar.xz
sl0ppij-ca98d8707fe01ca30958c3d31370ffe0dfc4506c.zip
feat(zellij-server): restore tab position when re-attaching (#4115)
Diffstat (limited to 'zellij-server')
-rw-r--r--zellij-server/src/screen.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs
index 78e954d7..3bbfc670 100644
--- a/zellij-server/src/screen.rs
+++ b/zellij-server/src/screen.rs
@@ -957,6 +957,7 @@ pub(crate) struct Screen {
connected_clients: Rc<RefCell<HashMap<ClientId, bool>>>, // bool -> is_web_client
/// The indices of this [`Screen`]'s active [`Tab`]s.
active_tab_indices: BTreeMap<ClientId, usize>,
+ global_last_active_tab_index: usize,
tab_history: BTreeMap<ClientId, Vec<usize>>,
pane_history: BTreeMap<ClientId, Vec<PaneId>>,
mode_info: BTreeMap<ClientId, ModeInfo>,
@@ -1046,6 +1047,7 @@ impl Screen {
style: client_attributes.style,
connected_clients: Rc::new(RefCell::new(HashMap::new())),
active_tab_indices: BTreeMap::new(),
+ global_last_active_tab_index: 0,
tabs: BTreeMap::new(),
terminal_emulator_colors: Rc::new(RefCell::new(Palette::default())),
terminal_emulator_color_codes: Rc::new(RefCell::new(HashMap::new())),
@@ -1966,6 +1968,8 @@ impl Screen {
self.active_tab_indices.iter().next()
{
*first_active_tab_index
+ } else if self.tabs.contains_key(&self.global_last_active_tab_index) {
+ self.global_last_active_tab_index
} else if self.tabs.contains_key(&0) {
0
} else if let Some(tab_index) = self.tabs.keys().next() {
@@ -2013,6 +2017,7 @@ impl Screen {
}
}
if self.active_tab_indices.contains_key(&client_id) {
+ self.global_last_active_tab_index = *self.active_tab_indices.get(&client_id).unwrap();
self.active_tab_indices.remove(&client_id);
}
if self.tab_history.contains_key(&client_id) {