fix: keep fresh-window single-tab bars hidden
- commit
- b7da822381d50e9ad11a253c208b5c6e734f5694
- author
- brice · · 2026-04-14 17:45 UTC
- parent
- 9488c51
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +8 -4
M internal/ui/app_browser_launch_test.go +7 -3
| @@ -224,9 +224,10 @@ func TestApp_OpenFreshWindowTargetsNewWindowTabBar(t *testing.T) { | |||
| 224 | 224 | }, | |
| 225 | 225 | mainWindow: oldWindow, | |
| 226 | 226 | tabCoord: coordinator.NewTabCoordinator(context.Background(), coordinator.TabCoordinatorConfig{ | |
| 227 | - | TabsUC: tabsUC, | |
| 228 | - | Tabs: tabs, | |
| 229 | - | MainWindow: oldWindow, | |
| 227 | + | TabsUC: tabsUC, | |
| 228 | + | Tabs: tabs, | |
| 229 | + | MainWindow: oldWindow, | |
| 230 | + | HideTabBarWhenSingleTab: true, | |
| 230 | 231 | }), | |
| 231 | 232 | workspaceViews: make(map[entity.TabID]*component.WorkspaceView), | |
| 232 | 233 | } | |
| @@ -249,4 +250,7 @@ func TestApp_OpenFreshWindowTargetsNewWindowTabBar(t *testing.T) { | |||
| 249 | 250 | if got := windowTabBarActiveID(t, oldWindow); got != "" { | |
| 250 | 251 | t.Fatalf("old window tab bar active tab = %q, want empty", got) | |
| 251 | 252 | } | |
| 253 | + | if got := newWindow.TabBar().Box().GetVisible(); got { | |
| 254 | + | t.Fatalf("new window tab bar visible = %v, want false", got) | |
| 255 | + | } | |
| 252 | 256 | } | |
| @@ -224,9 +224,10 @@ func TestApp_OpenFreshWindowTargetsNewWindowTabBar(t *testing.T) { | |||||
| 224 | }, | 224 | }, | ||
| 225 | mainWindow: oldWindow, | 225 | mainWindow: oldWindow, | ||
| 226 | tabCoord: coordinator.NewTabCoordinator(context.Background(), coordinator.TabCoordinatorConfig{ | 226 | tabCoord: coordinator.NewTabCoordinator(context.Background(), coordinator.TabCoordinatorConfig{ | ||
| 227 | - | TabsUC: tabsUC, | 227 | + | TabsUC: tabsUC, |
| 228 | - | Tabs: tabs, | 228 | + | Tabs: tabs, |
| 229 | - | MainWindow: oldWindow, | 229 | + | MainWindow: oldWindow, |
| 230 | + | HideTabBarWhenSingleTab: true, | |||
| 230 | }), | 231 | }), | ||
| 231 | workspaceViews: make(map[entity.TabID]*component.WorkspaceView), | 232 | workspaceViews: make(map[entity.TabID]*component.WorkspaceView), | ||
| 232 | } | 233 | } | ||
| @@ -249,4 +250,7 @@ func TestApp_OpenFreshWindowTargetsNewWindowTabBar(t *testing.T) { | |||||
| 249 | if got := windowTabBarActiveID(t, oldWindow); got != "" { | 250 | if got := windowTabBarActiveID(t, oldWindow); got != "" { | ||
| 250 | t.Fatalf("old window tab bar active tab = %q, want empty", got) | 251 | t.Fatalf("old window tab bar active tab = %q, want empty", got) | ||
| 251 | } | 252 | } | ||
| 253 | + | if got := newWindow.TabBar().Box().GetVisible(); got { | |||
| 254 | + | t.Fatalf("new window tab bar visible = %v, want false", got) | |||
| 255 | + | } | |||
| 252 | } | 256 | } | ||
M internal/ui/coordinator/tab.go +1 -1
| @@ -357,7 +357,7 @@ func (c *TabCoordinator) UpdateBarVisibility(ctx context.Context) { | |||
| 357 | 357 | return | |
| 358 | 358 | } | |
| 359 | 359 | ||
| 360 | - | tabCount := c.tabs.Count() | |
| 360 | + | tabCount := c.mainWindow.TabBar().Count() | |
| 361 | 361 | shouldShow := tabCount > 1 | |
| 362 | 362 | ||
| 363 | 363 | log.Debug().Int("tab_count", tabCount).Bool("should_show", shouldShow).Msg("setting tab bar visibility") | |
| @@ -357,7 +357,7 @@ func (c *TabCoordinator) UpdateBarVisibility(ctx context.Context) { | |||||
| 357 | return | 357 | return | ||
| 358 | } | 358 | } | ||
| 359 | 359 | ||||
| 360 | - | tabCount := c.tabs.Count() | 360 | + | tabCount := c.mainWindow.TabBar().Count() |
| 361 | shouldShow := tabCount > 1 | 361 | shouldShow := tabCount > 1 | ||
| 362 | 362 | ||||
| 363 | log.Debug().Int("tab_count", tabCount).Bool("should_show", shouldShow).Msg("setting tab bar visibility") | 363 | log.Debug().Int("tab_count", tabCount).Bool("should_show", shouldShow).Msg("setting tab bar visibility") | ||