From 9f270c25e72454c56cc8de353ac7dd8b60757bb9 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 5 Jan 2020 14:44:08 -0800 Subject: [PATCH] mux: fix tab title at attach time We were ignoring the title returned by list tabs and would subsequently only pick up the title after a later update. This passes the title in at construction. --- src/server/domain.rs | 9 +++++++-- src/server/tab.rs | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/server/domain.rs b/src/server/domain.rs index 2aa308026..f5ca0951e 100644 --- a/src/server/domain.rs +++ b/src/server/domain.rs @@ -179,7 +179,7 @@ impl Domain for ClientDomain { result.tab_id }; - let tab: Rc = Rc::new(ClientTab::new(&inner, remote_tab_id, size)); + let tab: Rc = Rc::new(ClientTab::new(&inner, remote_tab_id, size, "wezterm")); let mux = Mux::get().unwrap(); mux.add_tab(&tab)?; mux.add_tab_to_window(&tab, window)?; @@ -211,7 +211,12 @@ impl Domain for ClientDomain { entry.window_id, entry.title ); - let tab: Rc = Rc::new(ClientTab::new(&inner, entry.tab_id, entry.size)); + let tab: Rc = Rc::new(ClientTab::new( + &inner, + entry.tab_id, + entry.size, + &entry.title, + )); mux.add_tab(&tab)?; if let Some(local_window_id) = inner.remote_to_local_window(entry.window_id) { diff --git a/src/server/tab.rs b/src/server/tab.rs index cc3f0b056..6e29caee5 100644 --- a/src/server/tab.rs +++ b/src/server/tab.rs @@ -128,7 +128,12 @@ pub struct ClientTab { } impl ClientTab { - pub fn new(client: &Arc, remote_tab_id: TabId, size: PtySize) -> Self { + pub fn new( + client: &Arc, + remote_tab_id: TabId, + size: PtySize, + title: &str, + ) -> Self { let local_tab_id = alloc_tab_id(); let writer = TabWriter { client: Arc::clone(client), @@ -161,7 +166,7 @@ impl ClientTab { scrollback_top: 0, }, lines: LruCache::unbounded(), - title: "wezterm".to_string(), + title: title.to_string(), }), };