detached 4ea1430

fix: call onTabCreated before AddTab so window-scoped name is set

TabButton reads tab.Title() immediately when created, so the
window-scoped default name must be assigned before TabBar.AddTab().
commit
4ea143081f2cd8820afdb69b8d3f788daaffc955
author
brice · · 2026-04-28 07:14 UTC
parent
e6ff2cc
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +8 -6
M internal/ui/app.go +1 -1
@@ -2097,7 +2097,7 @@ func (a *App) initCoordinators(ctx context.Context) {
20972097 a.setBrowserWindowForTab(tab.ID, bw)
20982098 }
20992099 // Set a window-scoped default title so "Tab N" doesn't use global position.
2100- // Count tabs already owned by this window (excluding the one just added).
2100+ // Count tabs owned by this window. The new tab was just assigned above.
21012101 windowTabCount := 0
21022102 for _, owner := range a.windowForTab {
21032103 if owner == bw {
@@ -2097,7 +2097,7 @@ func (a *App) initCoordinators(ctx context.Context) {
2097 a.setBrowserWindowForTab(tab.ID, bw)2097 a.setBrowserWindowForTab(tab.ID, bw)
2098 }2098 }
2099 // Set a window-scoped default title so "Tab N" doesn't use global position.2099 // Set a window-scoped default title so "Tab N" doesn't use global position.
2100- // Count tabs already owned by this window (excluding the one just added).2100+ // Count tabs owned by this window. The new tab was just assigned above.
2101 windowTabCount := 02101 windowTabCount := 0
2102 for _, owner := range a.windowForTab {2102 for _, owner := range a.windowForTab {
2103 if owner == bw {2103 if owner == bw {
M internal/ui/coordinator/tab.go +7 -5
@@ -156,6 +156,13 @@ func (c *TabCoordinator) create(ctx context.Context, initialURL string, activate
156156 c.tabs.SetActive(output.Tab.ID)
157157 }
158158
159+ // Notify app before adding the tab to the visible tab bar.
160+ // The app assigns window ownership and the window-scoped default name here,
161+ // and TabBar.AddTab reads tab.Title() immediately when creating the button.
162+ if c.onTabCreated != nil {
163+ c.onTabCreated(ctx, output.Tab)
164+ }
165+
159166 // Update tab bar
160167 if c.mainWindow != nil && c.mainWindow.TabBar() != nil {
161168 c.mainWindow.TabBar().AddTab(output.Tab)
@@ -167,11 +174,6 @@ func (c *TabCoordinator) create(ctx context.Context, initialURL string, activate
167174 // Update tab bar visibility
168175 c.UpdateBarVisibility(ctx)
169176
170- // Notify app to create workspace view
171- if c.onTabCreated != nil {
172- c.onTabCreated(ctx, output.Tab)
173- }
174-
175177 // Switch to the new tab's workspace view when activation is requested.
176178 if activate && c.onTabSwitched != nil {
177179 c.onTabSwitched(ctx, output.Tab)
@@ -156,6 +156,13 @@ func (c *TabCoordinator) create(ctx context.Context, initialURL string, activate
156 c.tabs.SetActive(output.Tab.ID)156 c.tabs.SetActive(output.Tab.ID)
157 }157 }
158 158
159+ // Notify app before adding the tab to the visible tab bar.
160+ // The app assigns window ownership and the window-scoped default name here,
161+ // and TabBar.AddTab reads tab.Title() immediately when creating the button.
162+ if c.onTabCreated != nil {
163+ c.onTabCreated(ctx, output.Tab)
164+ }
165+
159 // Update tab bar166 // Update tab bar
160 if c.mainWindow != nil && c.mainWindow.TabBar() != nil {167 if c.mainWindow != nil && c.mainWindow.TabBar() != nil {
161 c.mainWindow.TabBar().AddTab(output.Tab)168 c.mainWindow.TabBar().AddTab(output.Tab)
@@ -167,11 +174,6 @@ func (c *TabCoordinator) create(ctx context.Context, initialURL string, activate
167 // Update tab bar visibility174 // Update tab bar visibility
168 c.UpdateBarVisibility(ctx)175 c.UpdateBarVisibility(ctx)
169 176
170- // Notify app to create workspace view
171- if c.onTabCreated != nil {
172- c.onTabCreated(ctx, output.Tab)
173- }
174-
175 // Switch to the new tab's workspace view when activation is requested.177 // Switch to the new tab's workspace view when activation is requested.
176 if activate && c.onTabSwitched != nil {178 if activate && c.onTabSwitched != nil {
177 c.onTabSwitched(ctx, output.Tab)179 c.onTabSwitched(ctx, output.Tab)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close