From b3e9dda726212da662587bb320e5758f07341dc3 Mon Sep 17 00:00:00 2001 From: AdaShoelace Date: Mon, 31 May 2021 17:00:14 +0200 Subject: [PATCH] Set tab name on creation instead of on render --- default-plugins/tab-bar/src/tab.rs | 6 +----- zellij-server/src/tab.rs | 6 +++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/default-plugins/tab-bar/src/tab.rs b/default-plugins/tab-bar/src/tab.rs index fb8e377d12..7e83e85bbe 100644 --- a/default-plugins/tab-bar/src/tab.rs +++ b/default-plugins/tab-bar/src/tab.rs @@ -46,11 +46,7 @@ pub fn tab_style( capabilities: PluginCapabilities, ) -> LinePart { let separator = tab_separator(capabilities); - let mut tab_text = if text.is_empty() { - format!("Tab #{}", position + 1) - } else { - text - }; + let mut tab_text = text; if is_sync_panes_active { tab_text.push_str(" (Sync)"); } diff --git a/zellij-server/src/tab.rs b/zellij-server/src/tab.rs index 7daf20925e..58efd29273 100644 --- a/zellij-server/src/tab.rs +++ b/zellij-server/src/tab.rs @@ -259,7 +259,11 @@ impl Tab { index, position, panes, - name, + name: if name.is_empty() { + format!("Tab #{} (unnamed)", position + 1) + } else { + name + }, max_panes, panes_to_hide: HashSet::new(), active_terminal: pane_id,