Skip to content

Commit 6b9afc7

Browse files
committed
Fix duplicate Session header in command palette on macOS
The speak command (macOS-only) was appended after the Settings commands, causing the category sequence Session → Settings → Session. This made buildLines render a second Session header. Extract Settings into its own builtInSettingsCommands function and reorder categories in BuildCommandCategories so that Settings appears before Feedback, which is always last. Assisted-By: cagent
1 parent 61eb1bb commit 6b9afc7

1 file changed

Lines changed: 30 additions & 11 deletions

File tree

pkg/tui/commands/commands.go

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,18 @@ func builtInSessionCommands() []Item {
212212
return core.CmdHandler(messages.AttachFileMsg{FilePath: arg})
213213
},
214214
},
215+
}
216+
217+
// Add speak command on supported platforms (macOS only)
218+
if speak := speakCommand(); speak != nil {
219+
cmds = append(cmds, *speak)
220+
}
221+
222+
return cmds
223+
}
224+
225+
func builtInSettingsCommands() []Item {
226+
return []Item{
215227
{
216228
ID: "settings.theme",
217229
Label: "Theme",
@@ -233,13 +245,6 @@ func builtInSessionCommands() []Item {
233245
},
234246
},
235247
}
236-
237-
// Add speak command on supported platforms (macOS only)
238-
if speak := speakCommand(); speak != nil {
239-
cmds = append(cmds, *speak)
240-
}
241-
242-
return cmds
243248
}
244249

245250
func builtInFeedbackCommands() []Item {
@@ -298,10 +303,6 @@ func BuildCommandCategories(ctx context.Context, application *app.App) []Categor
298303
Name: "Session",
299304
Commands: sessionCommands,
300305
},
301-
{
302-
Name: "Feedback",
303-
Commands: builtInFeedbackCommands(),
304-
},
305306
}
306307

307308
agentCommands := application.CurrentAgentCommands(ctx)
@@ -428,6 +429,18 @@ func BuildCommandCategories(ctx context.Context, application *app.App) []Categor
428429
})
429430
}
430431

432+
// Settings and Feedback are always last, in that order.
433+
categories = append(categories,
434+
Category{
435+
Name: "Settings",
436+
Commands: builtInSettingsCommands(),
437+
},
438+
Category{
439+
Name: "Feedback",
440+
Commands: builtInFeedbackCommands(),
441+
},
442+
)
443+
431444
return categories
432445
}
433446

@@ -449,5 +462,11 @@ func ParseSlashCommand(input string) tea.Cmd {
449462
}
450463
}
451464

465+
for _, item := range builtInSettingsCommands() {
466+
if item.SlashCommand == cmd {
467+
return item.Execute(arg)
468+
}
469+
}
470+
452471
return nil
453472
}

0 commit comments

Comments
 (0)